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
|
|
|
// Crate
|
|
|
|
use crate::render::FigureBoneData;
|
|
|
|
|
|
|
|
// Local
|
|
|
|
use super::{Bone, Skeleton};
|
|
|
|
|
|
|
|
const SCALE: f32 = 11.0;
|
|
|
|
|
|
|
|
#[derive(Clone)]
|
|
|
|
pub struct QuadrupedSkeleton {
|
2019-05-14 02:24:34 +00:00
|
|
|
pighead: Bone,
|
|
|
|
pigchest: Bone,
|
|
|
|
piglf_leg: Bone,
|
|
|
|
pigrf_leg: Bone,
|
|
|
|
piglb_leg: Bone,
|
|
|
|
pigrb_leg: Bone,
|
2019-05-13 23:43:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl QuadrupedSkeleton {
|
|
|
|
pub fn new() -> Self {
|
|
|
|
Self {
|
2019-05-14 02:24:34 +00:00
|
|
|
pighead: Bone::default(),
|
|
|
|
pigchest: Bone::default(),
|
|
|
|
piglf_leg: Bone::default(),
|
|
|
|
pigrf_leg: Bone::default(),
|
|
|
|
piglb_leg: Bone::default(),
|
|
|
|
pigrb_leg: Bone::default(),
|
2019-05-13 23:43:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Skeleton for QuadrupedSkeleton {
|
|
|
|
fn compute_matrices(&self) -> [FigureBoneData; 16] {
|
|
|
|
[
|
2019-05-14 02:24:34 +00:00
|
|
|
FigureBoneData::new(self.pighead.compute_base_matrix()),
|
|
|
|
FigureBoneData::new(self.pigchest.compute_base_matrix()),
|
|
|
|
FigureBoneData::new(self.piglf_leg.compute_base_matrix()),
|
|
|
|
FigureBoneData::new(self.pigrf_leg.compute_base_matrix()),
|
|
|
|
FigureBoneData::new(self.piglb_leg.compute_base_matrix()),
|
|
|
|
FigureBoneData::new(self.pigrb_leg.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(),
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
fn interpolate(&mut self, target: &Self) {
|
2019-05-14 02:24:34 +00:00
|
|
|
self.pighead.interpolate(&target.pighead);
|
|
|
|
self.pigchest.interpolate(&target.pigchest);
|
|
|
|
self.piglf_leg.interpolate(&target.piglf_leg);
|
|
|
|
self.pigrf_leg.interpolate(&target.pigrf_leg);
|
|
|
|
self.piglb_leg.interpolate(&target.piglb_leg);
|
|
|
|
self.pigrb_leg.interpolate(&target.pigrb_leg);
|
2019-05-13 23:43:10 +00:00
|
|
|
}
|
|
|
|
}
|