mirror of
https://codeberg.org/icewind/vmdl.git
synced 2026-06-03 16:44:11 +02:00
cleanup
This commit is contained in:
parent
2dffd8d7cd
commit
51e767a306
6 changed files with 15 additions and 66 deletions
20
src/lib.rs
20
src/lib.rs
|
|
@ -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> {
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue