pub struct MuscleRig { /* private fields */ }Expand description
A complete muscle rig: a collection of MuscleDefinitions with current
MuscleStates that can be evaluated into morph weights.
Implementations§
Source§impl MuscleRig
impl MuscleRig
Sourcepub fn add_muscle(&mut self, def: MuscleDefinition)
pub fn add_muscle(&mut self, def: MuscleDefinition)
Add a muscle definition to this rig. The state is initialised to the relaxed default.
Sourcepub fn set_state(&mut self, name: &str, state: MuscleState)
pub fn set_state(&mut self, name: &str, state: MuscleState)
Set the current state for a named muscle.
Sourcepub fn get_state(&self, name: &str) -> Option<&MuscleState>
pub fn get_state(&self, name: &str) -> Option<&MuscleState>
Get the current state for a named muscle, if it exists.
Sourcepub fn muscle_names(&self) -> Vec<&str>
pub fn muscle_names(&self) -> Vec<&str>
Return all muscle names in definition order.
Sourcepub fn muscles_in_group(&self, group: &MuscleGroup) -> Vec<&MuscleDefinition>
pub fn muscles_in_group(&self, group: &MuscleGroup) -> Vec<&MuscleDefinition>
Return all muscle definitions belonging to a given group.
Sourcepub fn evaluate(&self) -> HashMap<String, f32>
pub fn evaluate(&self) -> HashMap<String, f32>
Evaluate all muscle states and accumulate morph weights.
Multiple muscles can drive the same morph target; weights are additive
and clamped to [0, 1] per morph.
Sourcepub fn flex_group(&mut self, group: &MuscleGroup, amount: f32)
pub fn flex_group(&mut self, group: &MuscleGroup, amount: f32)
Flex all muscles in a group simultaneously to amount [0..1].
Sourcepub fn default_rig() -> Self
pub fn default_rig() -> Self
Build a standard human muscle rig with approximately 20 named muscles.
Sourcepub fn apply_fatigue(&mut self, threshold: f32, fatigue_rate: f32)
pub fn apply_fatigue(&mut self, threshold: f32, fatigue_rate: f32)
Apply fatigue to muscles whose flex exceeds threshold.
Each qualifying muscle has its fatigue increased by fatigue_rate,
clamped to [0, 1].
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MuscleRig
impl RefUnwindSafe for MuscleRig
impl Send for MuscleRig
impl Sync for MuscleRig
impl Unpin for MuscleRig
impl UnsafeUnpin for MuscleRig
impl UnwindSafe for MuscleRig
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more