pub struct BoneSkeleton {
pub root: BoneId,
pub ik_chains: Vec<IkChain>,
pub skin_weights: Vec<SkinWeight>,
/* private fields */
}Expand description
The full skeleton — flat map of bones plus hierarchy helpers.
Fields§
§root: BoneId§ik_chains: Vec<IkChain>§skin_weights: Vec<SkinWeight>Cached skin weights for the last set of surface points.
Implementations§
Source§impl BoneSkeleton
impl BoneSkeleton
pub fn new() -> Self
pub fn add_bone( &mut self, name: impl Into<String>, head: Vec3, tail: Vec3, ) -> BoneId
pub fn remove_bone(&mut self, id: BoneId) -> Option<BoneDesc>
pub fn get(&self, id: BoneId) -> Option<&BoneDesc>
pub fn get_mut(&mut self, id: BoneId) -> Option<&mut BoneDesc>
pub fn bones(&self) -> impl Iterator<Item = &BoneDesc>
pub fn bone_count(&self) -> usize
pub fn set_parent(&mut self, child: BoneId, parent: BoneId)
pub fn children_of(&self, id: BoneId) -> &[BoneId]
pub fn ancestors_of(&self, id: BoneId) -> Vec<BoneId>
pub fn depth_of(&self, id: BoneId) -> usize
Sourcepub fn world_head(&self, id: BoneId) -> Vec3
pub fn world_head(&self, id: BoneId) -> Vec3
World-space head of a bone (accumulates parent chain).
Sourcepub fn world_matrix(&self, id: BoneId) -> Mat4
pub fn world_matrix(&self, id: BoneId) -> Mat4
Accumulated world matrix for a bone’s head.
Sourcepub fn bind_weights(&mut self, surface_points: &[Vec3])
pub fn bind_weights(&mut self, surface_points: &[Vec3])
Compute smooth bind weights for a list of surface points.
Sourcepub fn build_humanoid(height: f32) -> Self
pub fn build_humanoid(height: f32) -> Self
Build a standard humanoid skeleton from SDF body proportions.
Trait Implementations§
Source§impl Debug for BoneSkeleton
impl Debug for BoneSkeleton
Auto Trait Implementations§
impl Freeze for BoneSkeleton
impl RefUnwindSafe for BoneSkeleton
impl Send for BoneSkeleton
impl Sync for BoneSkeleton
impl Unpin for BoneSkeleton
impl UnsafeUnpin for BoneSkeleton
impl UnwindSafe for BoneSkeleton
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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.