bone names

This commit is contained in:
Robin Appelman 2023-12-29 16:48:19 +01:00
commit c58d911bf6
7 changed files with 63 additions and 28 deletions

View file

@ -18,9 +18,7 @@ fn main() -> Result<(), vmdl::ModelError> {
let _vvd = Vvd::read(&data)?;
for bone in mdl.bones {
dbg!(bone.flags);
dbg!(bone.rot);
dbg!(bone.quaternion);
println!("{}: from {} at {:?}", bone.name, bone.parent, bone.rot);
}
// let model = Model::from_parts(mdl, vtx, vvd);

View file

@ -252,8 +252,10 @@ fn model_to_model(model: &Model, loader: &Loader, skin: usize) -> CpuModel {
let transforms = model
.bones()
.filter(|bone| bone.name == "root")
.next()
.map(|bone| Mat4::from(cgmath::Quaternion::from(bone.rot)))
.fold(Mat4::identity(), |a, b| a * b);
.unwrap_or_else(|| Matrix4::identity());
let geometries = model
.meshes()