pub struct EmotionSystem { /* private fields */ }Expand description
Maps emotions to morph target weights and evaluates blended expressions.
Implementations§
Source§impl EmotionSystem
impl EmotionSystem
Sourcepub fn add_expression(&mut self, expr: EmotionExpression)
pub fn add_expression(&mut self, expr: EmotionExpression)
Register or replace an expression for its emotion.
Sourcepub fn get_expression(&self, emotion: &Emotion) -> Option<&EmotionExpression>
pub fn get_expression(&self, emotion: &Emotion) -> Option<&EmotionExpression>
Look up the expression for the given emotion.
Sourcepub fn evaluate(&self, blend: &EmotionBlend) -> HashMap<String, f32>
pub fn evaluate(&self, blend: &EmotionBlend) -> HashMap<String, f32>
Evaluate blended morph weights for a given emotion blend.
For each emotion component with weight > 0, the expression weights are
scaled by component_weight * expression.intensity, then additively blended
and clamped to [0, 1].
Sourcepub fn evaluate_single(
&self,
emotion: &Emotion,
intensity: f32,
) -> HashMap<String, f32>
pub fn evaluate_single( &self, emotion: &Emotion, intensity: f32, ) -> HashMap<String, f32>
Evaluate a single emotion at the given intensity (overrides expression intensity).
Sourcepub fn from_valence_arousal(&self, valence: f32, arousal: f32) -> EmotionBlend
pub fn from_valence_arousal(&self, valence: f32, arousal: f32) -> EmotionBlend
Convert a valence-arousal coordinate to an emotion blend using inverse-distance weighting (IDW) over the 3 nearest emotions in V-A space.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EmotionSystem
impl RefUnwindSafe for EmotionSystem
impl Send for EmotionSystem
impl Sync for EmotionSystem
impl Unpin for EmotionSystem
impl UnsafeUnpin for EmotionSystem
impl UnwindSafe for EmotionSystem
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> 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>
Converts
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>
Converts
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