1 unstable release
0.1.0 | Jul 23, 2021 |
---|
#100 in Data formats
Used in vox-tool
87KB
2K
SLoC
vox-format
vox-format
is a parser and encoder for MagicaVoxel's VOX files.
Usage
In your Cargo.toml
add:
[dependencies]
vox-format = "0.1"
Example
let vox_data = vox_format::from_file("test_files/glider.vox")?;
println!("{:#?}", vox_data);
lib.rs
:
Overview
This crate provides a reader and write for MagicaVoxel's VOX files. It was designed with the
in mind to keep copying to a minimum. While you can read a full VOX file
into a VoxData
and then read or manipulate its data, there's also an
interface to construct your own voxel data from a VOX file.
If you're looking for a command-line utility to manipulate VOX files, take a look at vox-tool
.
vox-tool
is written using vox-format
. so everything it does, can also be
achieved using only this crate in Rust.
Features
image
support
This crate has support for some conversion between its types and image
types. Specifically between crate::types::Color
and Rgba<u8>
. But it
also provides methods to read and write palettes from images.
mint
and nalgebra
support
The feature mint
and nalgebra
enables conversion for
crate::types::Vector
for these crates.
palette
support
This feature enables conversion between crate::types::Color
and
Srgb<u8>
from the palette
crate.
serialize
Enables serialization using serde
for types in crate::types
and
crate::data::VoxData
.
This crate is work-in-progress
Although this crate has a very limited scope and already mostly implements it, it is missing some features and isn't well-tested yet. This will change soon, but if you just can't wait, you're welcome to contribute 🥺.
Examples
Reads crate::data::VoxData
from path:
let vox_data = vox_format::from_file(path).unwrap();
println!("{:#?}", vox_data);
Dependencies
~0.4–2.7MB
~50K SLoC