pub fn apply(&self, model: &mut Model, mut weight: f32) {
        weight = weight.min(1.0).max(0.0);
        for (id, blend_type, value) in self.parameters.iter().copied() {
            let model_value = &mut model.parameter_values_mut()[id];
            *model_value = match blend_type {
                ExpressionBlendType::Add => *model_value + value * weight,
                ExpressionBlendType::Multiply => *model_value * (1.0 + (value - 1.0) * weight),
                ExpressionBlendType::Overwrite => value * weight,
            };
        }
    }
/// Apply an expression to a model.
Apply an expression to a model.
Apply an expression to a model .
pub fn apply(&self, model: &mut Model, mut weight: f32) {
        weight = weight.min(1.0).max(0.0);
        for (id, blend_type, value) in self.parameters.iter().copied() {
            let model_value = &mut model.parameter_values_mut()[id];
            *model_value = match blend_type {
                ExpressionBlendType::Add => *model_value + value * weight,
                ExpressionBlendType::Multiply => *model_value * (1.0 + (value - 1.0) * weight),
                ExpressionBlendType::Overwrite => value * weight,
            };
        }
    }
pub fn apply ( & self , model : & mut Model , mut weight : f32 ) { weight = weight . min ( 1.0 ) . max ( 0.0 ) ; for ( id , blend_type , value ) in self . parameters . iter ( ) . copied ( ) { let model_value = & mut model . parameter_values_mut ( ) [ id ] ; * model_value = match blend_type { ExpressionBlendType :: Add => * model_value + value * weight , ExpressionBlendType :: Multiply => * model_value * ( 1.0 + ( value - 1.0 ) * weight ) , ExpressionBlendType :: Overwrite => value * weight , } ; } }
Apply an expression to a model.
Apply an expression to a model .
&self
model
&mut Model
weight
f32
&self
model
&mut Model
weight
f32