1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use amethyst_core::cgmath::Matrix4;
use amethyst_core::specs::prelude::{Component, DenseVecStorage, Entity};
use hibitset::BitSet;

/// Joint, attach to an entity with a `Transform`
#[derive(Debug, Clone)]
pub struct Joint {
    /// Bring the mesh into the joints local coordinate system
    pub inverse_bind_matrix: Matrix4<f32>,
    pub skin: Entity,
}

impl Component for Joint {
    type Storage = DenseVecStorage<Self>;
}

/// Skin, attach to the root entity in the mesh hierarchy
#[derive(Debug)]
pub struct Skin {
    /// Joint entities for the skin
    pub joints: Vec<Entity>,
    /// Mesh entities that use the skin
    pub meshes: BitSet,
    /// Bind shape matrix
    pub bind_shape_matrix: Matrix4<f32>,
}

impl Component for Skin {
    type Storage = DenseVecStorage<Self>;
}