2019-05-26 03:31:41 +00:00
|
|
|
pub mod idle;
|
|
|
|
pub mod jump;
|
|
|
|
pub mod run;
|
|
|
|
|
|
|
|
// Reexports
|
|
|
|
pub use self::idle::IdleAnimation;
|
|
|
|
pub use self::jump::JumpAnimation;
|
|
|
|
pub use self::run::RunAnimation;
|
|
|
|
|
|
|
|
use super::{Bone, Skeleton};
|
2019-06-06 14:48:41 +00:00
|
|
|
use crate::render::FigureBoneData;
|
2019-05-26 03:31:41 +00:00
|
|
|
|
|
|
|
#[derive(Clone)]
|
|
|
|
pub struct QuadrupedMediumSkeleton {
|
2019-05-31 01:33:54 +00:00
|
|
|
wolf_head_upper: Bone,
|
2019-05-26 03:31:41 +00:00
|
|
|
wolf_jaw: Bone,
|
2019-05-31 01:33:54 +00:00
|
|
|
wolf_head_lower: Bone,
|
2019-05-26 03:31:41 +00:00
|
|
|
wolf_tail: Bone,
|
2019-05-31 01:33:54 +00:00
|
|
|
wolf_torso_back: Bone,
|
|
|
|
wolf_torso_mid: Bone,
|
2019-05-26 03:31:41 +00:00
|
|
|
wolf_ears: Bone,
|
2019-05-31 01:33:54 +00:00
|
|
|
wolf_foot_lf: Bone,
|
|
|
|
wolf_foot_rf: Bone,
|
|
|
|
wolf_foot_lb: Bone,
|
|
|
|
wolf_foot_rb: Bone,
|
2019-05-26 03:31:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl QuadrupedMediumSkeleton {
|
|
|
|
pub fn new() -> Self {
|
|
|
|
Self {
|
2019-05-31 01:33:54 +00:00
|
|
|
wolf_head_upper: Bone::default(),
|
2019-05-26 03:31:41 +00:00
|
|
|
wolf_jaw: Bone::default(),
|
2019-05-31 01:33:54 +00:00
|
|
|
wolf_head_lower: Bone::default(),
|
2019-05-26 03:31:41 +00:00
|
|
|
wolf_tail: Bone::default(),
|
2019-05-31 01:33:54 +00:00
|
|
|
wolf_torso_back: Bone::default(),
|
|
|
|
wolf_torso_mid: Bone::default(),
|
2019-05-26 03:31:41 +00:00
|
|
|
wolf_ears: Bone::default(),
|
2019-05-31 01:33:54 +00:00
|
|
|
wolf_foot_lf: Bone::default(),
|
|
|
|
wolf_foot_rf: Bone::default(),
|
|
|
|
wolf_foot_lb: Bone::default(),
|
|
|
|
wolf_foot_rb: Bone::default(),
|
2019-05-26 03:31:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Skeleton for QuadrupedMediumSkeleton {
|
|
|
|
fn compute_matrices(&self) -> [FigureBoneData; 16] {
|
|
|
|
let ears_mat = self.wolf_ears.compute_base_matrix();
|
2019-05-31 01:33:54 +00:00
|
|
|
let head_upper_mat = self.wolf_head_upper.compute_base_matrix();
|
|
|
|
let head_lower_mat = self.wolf_head_lower.compute_base_matrix();
|
2019-05-26 03:31:41 +00:00
|
|
|
|
|
|
|
[
|
2019-05-31 01:33:54 +00:00
|
|
|
FigureBoneData::new(head_upper_mat),
|
2019-05-26 03:31:41 +00:00
|
|
|
FigureBoneData::new(
|
2019-05-31 01:33:54 +00:00
|
|
|
head_upper_mat * head_lower_mat * self.wolf_jaw.compute_base_matrix(),
|
2019-05-26 03:31:41 +00:00
|
|
|
),
|
2019-05-31 01:33:54 +00:00
|
|
|
FigureBoneData::new(head_upper_mat * head_lower_mat),
|
2019-05-26 03:31:41 +00:00
|
|
|
FigureBoneData::new(self.wolf_tail.compute_base_matrix()),
|
2019-05-31 01:33:54 +00:00
|
|
|
FigureBoneData::new(self.wolf_torso_back.compute_base_matrix()),
|
|
|
|
FigureBoneData::new(self.wolf_torso_mid.compute_base_matrix()),
|
|
|
|
FigureBoneData::new(head_upper_mat * ears_mat),
|
|
|
|
FigureBoneData::new(self.wolf_foot_lf.compute_base_matrix()),
|
|
|
|
FigureBoneData::new(self.wolf_foot_rf.compute_base_matrix()),
|
|
|
|
FigureBoneData::new(self.wolf_foot_lb.compute_base_matrix()),
|
|
|
|
FigureBoneData::new(self.wolf_foot_rb.compute_base_matrix()),
|
2019-05-26 03:31:41 +00:00
|
|
|
FigureBoneData::default(),
|
|
|
|
FigureBoneData::default(),
|
|
|
|
FigureBoneData::default(),
|
|
|
|
FigureBoneData::default(),
|
|
|
|
FigureBoneData::default(),
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2019-06-16 17:45:01 +00:00
|
|
|
fn interpolate(&mut self, target: &Self, dt: f32) {
|
|
|
|
self.wolf_head_upper
|
|
|
|
.interpolate(&target.wolf_head_upper, dt);
|
|
|
|
self.wolf_jaw.interpolate(&target.wolf_jaw, dt);
|
|
|
|
self.wolf_head_lower
|
|
|
|
.interpolate(&target.wolf_head_lower, dt);
|
|
|
|
self.wolf_tail.interpolate(&target.wolf_tail, dt);
|
|
|
|
self.wolf_torso_back
|
|
|
|
.interpolate(&target.wolf_torso_back, dt);
|
|
|
|
self.wolf_torso_mid.interpolate(&target.wolf_torso_mid, dt);
|
|
|
|
self.wolf_ears.interpolate(&target.wolf_ears, dt);
|
|
|
|
self.wolf_foot_lf.interpolate(&target.wolf_foot_lf, dt);
|
|
|
|
self.wolf_foot_rf.interpolate(&target.wolf_foot_rf, dt);
|
|
|
|
self.wolf_foot_lb.interpolate(&target.wolf_foot_lb, dt);
|
|
|
|
self.wolf_foot_rb.interpolate(&target.wolf_foot_rb, dt);
|
2019-05-26 03:31:41 +00:00
|
|
|
}
|
|
|
|
}
|