Function dot_vox::load [−][src]
pub fn load(filename: &str) -> Result<DotVoxData, &'static str>
Loads the supplied MagicaVoxel .vox file
Loads the supplied file, parses it, and returns a DotVoxData
containing
the version of the MagicaVoxel file, a Vec<Model>
containing all Model
s
contained within the file, a Vec<u32>
containing the palette information
(RGBA), and a Vec<Material>
containing all the specialized materials.
Panics
No panics should occur with this library - if you find one, please raise a GitHub issue for it.
Errors
All errors are strings, and should describe the issue that caused them to occur.
Examples
Loading a file:
use dot_vox::*; let result = load("src/resources/placeholder.vox"); assert_eq!(result.unwrap(), DotVoxData { version: 150, models: vec!( Model { size: Size { x: 2, y: 2, z: 2 }, voxels: vec!( Voxel { x: 0, y: 0, z: 0, i: 225 }, Voxel { x: 0, y: 1, z: 1, i: 215 }, Voxel { x: 1, y: 0, z: 1, i: 235 }, Voxel { x: 1, y: 1, z: 0, i: 5 } ) } ), palette: DEFAULT_PALETTE.to_vec(), materials: vec![], });