pub struct Skeleton {
pub skeleton: Hierarchy<Bone>,
pub roots: Vec<(usize, Recipe)>,
pub temp_mat4s: Vec<Mat4>,
pub max_index: usize,
}
Expand description
A set of related bones, with one or more roots
This corresponds to a skeleton (or a number thereof), with each bone appearing once in each skeleton. The bones form a hierarchy.
Fields§
§skeleton: Hierarchy<Bone>
The bones that make up the set, with the hierarchical relationships
roots: Vec<(usize, Recipe)>
The roots of the bones and hierarchical recipes for traversal
temp_mat4s: Vec<Mat4>
An array of matrices long enough for the one per level of traversal
max_index: usize
Max bone index
Implementations§
Source§impl Skeleton
impl Skeleton
Sourcepub fn add_bone(
&mut self,
transformation: Transformation,
matrix_index: usize,
) -> usize
pub fn add_bone( &mut self, transformation: Transformation, matrix_index: usize, ) -> usize
Add a bone with a given base Transformation relative to its parent (if it has one), and an index to a Vec of Mat4 that the bone pose will utilize
It returns the bone reference index
Sourcepub fn relate(&mut self, parent: usize, child: usize)
pub fn relate(&mut self, parent: usize, child: usize)
Relate a parent bone to a child bone (by bone reference indices)
Sourcepub fn resolve(&mut self)
pub fn resolve(&mut self)
Resolve the Skeleton by finding the roots, generating traversal hierarchy::Recipes for each root, allocating the required number of temporary Mat4s for the deepest of all the recipes, and finding the number of bone matrices required to be exported
Sourcepub fn rewrite_indices(&mut self)
pub fn rewrite_indices(&mut self)
Sourcepub fn derive_matrices(&mut self)
pub fn derive_matrices(&mut self)
Sourcepub fn iter_roots(&self) -> impl Iterator<Item = usize> + '_
pub fn iter_roots(&self) -> impl Iterator<Item = usize> + '_
Iterate through the root bone indices in the Skeleton