mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
6b09fd7c53
Former-commit-id: eb49765c911aaa97a9c8ed351216a7a6f8411213
72 lines
2.1 KiB
Rust
72 lines
2.1 KiB
Rust
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;
|
|
|
|
// Crate
|
|
use crate::render::FigureBoneData;
|
|
|
|
// Local
|
|
use super::{Bone, Skeleton};
|
|
|
|
const SCALE: f32 = 11.0;
|
|
|
|
#[derive(Clone)]
|
|
pub struct QuadrupedSkeleton {
|
|
pig_head: Bone,
|
|
pig_chest: Bone,
|
|
pig_leg_lf: Bone,
|
|
pig_leg_rf: Bone,
|
|
pig_leg_lb: Bone,
|
|
pig_leg_rb: Bone,
|
|
}
|
|
|
|
impl QuadrupedSkeleton {
|
|
pub fn new() -> Self {
|
|
Self {
|
|
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(),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl Skeleton for QuadrupedSkeleton {
|
|
fn compute_matrices(&self) -> [FigureBoneData; 16] {
|
|
[
|
|
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()),
|
|
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) {
|
|
self.pig_head.interpolate(&target.pig_head);
|
|
self.pig_chest.interpolate(&target.pig_chest);
|
|
self.pig_leg_lf.interpolate(&target.pig_leg_lf);
|
|
self.pig_leg_rf.interpolate(&target.pig_leg_rf);
|
|
self.pig_leg_lb.interpolate(&target.pig_leg_lb);
|
|
self.pig_leg_rb.interpolate(&target.pig_leg_rb);
|
|
}
|
|
}
|