pub struct BoneMask {
pub weights: Vec<f32>,
}Expand description
Per-bone blend weights in [0.0, 1.0] used for partial-body animation layers.
A weight of 1.0 means the layer fully overrides that bone; 0.0 means
the bone is untouched.
Fields§
§weights: Vec<f32>Indexed by bone index (same order as Skeleton::bones).
Implementations§
Source§impl BoneMask
impl BoneMask
Sourcepub fn uniform(bone_count: usize, default_weight: f32) -> Self
pub fn uniform(bone_count: usize, default_weight: f32) -> Self
Create a mask with all weights set to default_weight.
Sourcepub fn upper_body(skeleton: &Skeleton) -> Self
pub fn upper_body(skeleton: &Skeleton) -> Self
Upper-body preset for a standard humanoid skeleton.
Sets bones named with “spine”, “chest”, “neck”, “head”, “shoulder”, “arm”, “hand”, “finger”, “clavicle” to weight 1.0; all others to 0.0.
Sourcepub fn lower_body(skeleton: &Skeleton) -> Self
pub fn lower_body(skeleton: &Skeleton) -> Self
Lower-body preset for a standard humanoid skeleton.
Sets bones named with “hip”, “pelvis”, “leg”, “knee”, “ankle”, “foot”, “toe” to weight 1.0; all others to 0.0.
Sourcepub fn set_weight(&mut self, id: BoneId, weight: f32)
pub fn set_weight(&mut self, id: BoneId, weight: f32)
Set the weight for a specific bone.
Sourcepub fn get_weight(&self, id: BoneId) -> f32
pub fn get_weight(&self, id: BoneId) -> f32
Get the weight for a specific bone.
Sourcepub fn union(&self, other: &BoneMask) -> Self
pub fn union(&self, other: &BoneMask) -> Self
Combine two masks by taking the maximum weight per bone.
Sourcepub fn intersection(&self, other: &BoneMask) -> Self
pub fn intersection(&self, other: &BoneMask) -> Self
Combine two masks by taking the minimum weight per bone.
Sourcepub fn from_pairs(bone_count: usize, pairs: &[(BoneId, f32)]) -> Self
pub fn from_pairs(bone_count: usize, pairs: &[(BoneId, f32)]) -> Self
Build a mask from an explicit list of (BoneId, weight) pairs.
Sourcepub fn from_bone_subtree(
skeleton: &Skeleton,
root_bones: &[BoneId],
weight: f32,
) -> Self
pub fn from_bone_subtree( skeleton: &Skeleton, root_bones: &[BoneId], weight: f32, ) -> Self
Build a mask where only the listed bones (and their children) are active.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BoneMask
impl RefUnwindSafe for BoneMask
impl Send for BoneMask
impl Sync for BoneMask
impl Unpin for BoneMask
impl UnsafeUnpin for BoneMask
impl UnwindSafe for BoneMask
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
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>
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>
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)
&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)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.