3 releases

0.1.2 Jul 22, 2024
0.1.1 Mar 29, 2024
0.1.0 Mar 13, 2024

#42 in Data formats

38 downloads per month

MIT/Apache

21KB
689 lines

Roblox Mesh Parser

Example

use rbx_mesh::{read_versioned,mesh::{VersionedMesh,SizeOfVertex2}};

let file=std::fs::File::open("torso.mesh")?;
let input=std::io::BufReader::new(file);
let versioned_mesh=read_versioned(input)?;
match versioned_mesh{
	VersionedMesh::Version1(mesh)=>println!("{:?}",mesh.vertices),
	VersionedMesh::Version2(mesh)=>{
		match mesh.header.sizeof_vertex{
			SizeOfVertex2::Full=>println!("{:?}",mesh.vertices),
			SizeOfVertex2::Truncated=>println!("{:?}",mesh.vertices_truncated),
		}
	},
	VersionedMesh::Version3(mesh)=>{
		match mesh.header.sizeof_vertex{
			SizeOfVertex2::Full=>println!("{:?}",mesh.vertices),
			SizeOfVertex2::Truncated=>println!("{:?}",mesh.vertices_truncated),
		}
	},
	VersionedMesh::Version4(mesh)=>println!("{:?}",mesh.vertices),
	VersionedMesh::Version5(mesh)=>println!("{:?}",mesh.vertices),
}

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~2.7–4.5MB
~77K SLoC