2019-01-14 14:40:22 +00:00
|
|
|
pub mod character;
|
|
|
|
|
2019-01-13 20:53:55 +00:00
|
|
|
// Library
|
|
|
|
use vek::*;
|
|
|
|
|
|
|
|
// Crate
|
|
|
|
use crate::render::FigureBoneData;
|
|
|
|
|
|
|
|
#[derive(Copy, Clone)]
|
|
|
|
pub struct Bone {
|
|
|
|
pub offset: Vec3<f32>,
|
|
|
|
pub ori: Quaternion<f32>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Bone {
|
|
|
|
pub fn default() -> Self {
|
|
|
|
Self {
|
|
|
|
offset: Vec3::zero(),
|
|
|
|
ori: Quaternion::identity(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn compute_base_matrix(&self) -> Mat4<f32> {
|
|
|
|
Mat4::<f32>::translation_3d(self.offset) * Mat4::from(self.ori)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-14 14:18:58 +00:00
|
|
|
pub trait Skeleton {
|
|
|
|
fn compute_matrices(&self) -> [FigureBoneData; 16];
|
2019-01-13 20:53:55 +00:00
|
|
|
}
|
|
|
|
|
2019-01-14 14:18:58 +00:00
|
|
|
pub trait Animation {
|
|
|
|
type Skeleton;
|
|
|
|
type Dependency;
|
|
|
|
|
|
|
|
fn update_skeleton(
|
|
|
|
skeleton: &mut Self::Skeleton,
|
|
|
|
dependency: Self::Dependency,
|
|
|
|
);
|
|
|
|
}
|