2019-05-15 04:24:36 +00:00
|
|
|
pub mod idle;
|
|
|
|
pub mod jump;
|
2019-05-16 19:23:45 +00:00
|
|
|
pub mod run;
|
2019-05-13 23:43:10 +00:00
|
|
|
|
|
|
|
// Reexports
|
2019-05-15 04:24:36 +00:00
|
|
|
pub use self::idle::IdleAnimation;
|
|
|
|
pub use self::jump::JumpAnimation;
|
2019-05-16 19:23:45 +00:00
|
|
|
pub use self::run::RunAnimation;
|
2019-05-15 04:24:36 +00:00
|
|
|
|
2019-05-13 23:43:10 +00:00
|
|
|
use super::{Bone, Skeleton};
|
2019-06-06 14:48:41 +00:00
|
|
|
use crate::render::FigureBoneData;
|
2019-05-13 23:43:10 +00:00
|
|
|
|
|
|
|
#[derive(Clone)]
|
2019-10-25 01:26:32 +00:00
|
|
|
pub struct QuadrupedSmallSkeleton {
|
2019-05-17 09:22:32 +00:00
|
|
|
pig_head: Bone,
|
|
|
|
pig_chest: Bone,
|
|
|
|
pig_leg_lf: Bone,
|
|
|
|
pig_leg_rf: Bone,
|
|
|
|
pig_leg_lb: Bone,
|
|
|
|
pig_leg_rb: Bone,
|
2019-05-13 23:43:10 +00:00
|
|
|
}
|
|
|
|
|
2019-10-25 01:26:32 +00:00
|
|
|
impl QuadrupedSmallSkeleton {
|
2019-05-13 23:43:10 +00:00
|
|
|
pub fn new() -> Self {
|
|
|
|
Self {
|
2019-05-17 09:22:32 +00:00
|
|
|
pig_head: Bone::default(),
|
|
|
|
pig_chest: Bone::default(),
|
|
|
|
pig_leg_lf: Bone::default(),
|
|
|
|
pig_leg_rf: Bone::default(),
|
|
|
|
pig_leg_lb: Bone::default(),
|
|
|
|
pig_leg_rb: Bone::default(),
|
2019-05-13 23:43:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-25 01:26:32 +00:00
|
|
|
impl Skeleton for QuadrupedSmallSkeleton {
|
2019-05-13 23:43:10 +00:00
|
|
|
fn compute_matrices(&self) -> [FigureBoneData; 16] {
|
|
|
|
[
|
2019-05-17 09:22:32 +00:00
|
|
|
FigureBoneData::new(self.pig_head.compute_base_matrix()),
|
|
|
|
FigureBoneData::new(self.pig_chest.compute_base_matrix()),
|
|
|
|
FigureBoneData::new(self.pig_leg_lf.compute_base_matrix()),
|
|
|
|
FigureBoneData::new(self.pig_leg_rf.compute_base_matrix()),
|
|
|
|
FigureBoneData::new(self.pig_leg_lb.compute_base_matrix()),
|
|
|
|
FigureBoneData::new(self.pig_leg_rb.compute_base_matrix()),
|
2019-05-13 23:43:10 +00:00
|
|
|
FigureBoneData::default(),
|
|
|
|
FigureBoneData::default(),
|
|
|
|
FigureBoneData::default(),
|
|
|
|
FigureBoneData::default(),
|
|
|
|
FigureBoneData::default(),
|
|
|
|
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.pig_head.interpolate(&target.pig_head, dt);
|
|
|
|
self.pig_chest.interpolate(&target.pig_chest, dt);
|
|
|
|
self.pig_leg_lf.interpolate(&target.pig_leg_lf, dt);
|
|
|
|
self.pig_leg_rf.interpolate(&target.pig_leg_rf, dt);
|
|
|
|
self.pig_leg_lb.interpolate(&target.pig_leg_lb, dt);
|
|
|
|
self.pig_leg_rb.interpolate(&target.pig_leg_rb, dt);
|
2019-05-13 23:43:10 +00:00
|
|
|
}
|
|
|
|
}
|