pub struct Skeleton {
pub bones: Vec<Bone>,
pub name_index: HashMap<String, BoneId>,
}Expand description
The bone hierarchy for a character or object.
Bones are stored in a flat Vec sorted so that parents always appear
before their children (topological order). This allows a single forward
pass to compute world-space transforms.
Fields§
§bones: Vec<Bone>§name_index: HashMap<String, BoneId>Implementations§
Source§impl Skeleton
impl Skeleton
pub fn is_empty(&self) -> bool
Sourcepub fn bone_by_name(&self, name: &str) -> Option<&Bone>
pub fn bone_by_name(&self, name: &str) -> Option<&Bone>
Look up a bone by name.
Sourcepub fn compute_bind_world_matrices(&self) -> Vec<Mat4>
pub fn compute_bind_world_matrices(&self) -> Vec<Mat4>
Compute the world-space (model-space) bind pose matrices for all bones. Returned in bone-index order.
Sourcepub fn recompute_inv_bind_matrices(&mut self)
pub fn recompute_inv_bind_matrices(&mut self)
Recompute all inv_bind_matrix fields from current bind pose.
Sourcepub fn topological_order(&self) -> Vec<BoneId>
pub fn topological_order(&self) -> Vec<BoneId>
Collect all bone ids in topological order (parent before child).
Sourcepub fn children_of(&self, id: BoneId) -> &[BoneId]
pub fn children_of(&self, id: BoneId) -> &[BoneId]
Get child ids of a bone.
Source§impl Skeleton
impl Skeleton
Sourcepub fn standard_humanoid() -> Self
pub fn standard_humanoid() -> Self
Build a minimal standard humanoid skeleton (22 bones).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Skeleton
impl RefUnwindSafe for Skeleton
impl Send for Skeleton
impl Sync for Skeleton
impl Unpin for Skeleton
impl UnsafeUnpin for Skeleton
impl UnwindSafe for Skeleton
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.