This commit is contained in:
Robin Appelman 2023-12-30 22:57:25 +01:00
commit 50144ca1dd
8 changed files with 45 additions and 18 deletions

View file

@ -19,16 +19,12 @@ fn main() -> Result<(), vmdl::ModelError> {
let _vvd = Vvd::read(&data)?;
println!("{:?}", mdl.header.flags);
dbg!(mdl.local_animations);
// for bone in mdl.bones {
// println!(
// "{}: from {} at\n\t{:?}\n\t{:?}",
// bone.name,
// bone.parent,
// bone.quaternion,
// bone.pose_to_bone.rotation()
// );
// }
for bone in mdl.bones {
println!(
"{}: from {} at\n\t{:?}\n\t{:?}",
bone.name, bone.parent, bone.quaternion, bone.q_alignment
);
}
// let model = Model::from_parts(mdl, vtx, vvd);
// for strip in model.vertex_strips() {

View file

@ -262,7 +262,8 @@ fn model_to_model(model: &Model, loader: &Loader, skin: usize) -> CpuModel {
let positions: Vec<Vec3> = mesh
.vertices()
.map(|vertex| map_coords(vertex.position + offset) * 10.0)
.map(|vertex| model.vertex_to_world_space(vertex))
.map(|position| map_coords(position) * 10.0)
.map(|vertex: Vec3| (transforms * vertex.extend(1.0)).truncate())
.collect();
let normals: Vec<Vec3> = mesh.vertices().map(|vertex| vertex.normal.into()).collect();