This commit is contained in:
Robin Appelman 2024-08-29 13:30:17 +02:00
commit 51e767a306
6 changed files with 15 additions and 66 deletions

View file

@ -145,12 +145,7 @@ impl Model {
self.bones()
.next()
.map(|bone| {
// let inv = Matrix4::from(bone.pose_to_bone)
// .inverse_transform()
// .unwrap();
Matrix4::from(bone.rot)
})
.map(|bone| Matrix4::from(bone.rot))
.unwrap_or_else(Matrix4::identity)
}
@ -183,19 +178,6 @@ impl Model {
.transform_vector(Vector3::from(vertex.position))
.into()
}
fn bone_transform(
&self,
bone_id: u8,
bone: &Bone,
animation: &AnimationDescription,
weight: f32,
frame: usize,
) -> Matrix4<f32> {
let animation_transform = weight * animation.get_bone_transform(bone_id, frame);
let bone_origin = Matrix4::from(bone.pose_to_bone);
bone_origin.inverse_transform().unwrap() * animation_transform * bone_origin
}
}
pub struct SkinTable<'a> {

View file

@ -41,7 +41,7 @@ impl Vector {
pub fn transformed<T: Into<Matrix4<f32>>>(&self, transform: T) -> Vector {
let transform = transform.into();
transform.transform_vector(self.clone().into()).into()
transform.transform_vector((*self).into()).into()
}
}