fn process_sampler<T>(
    control: &mut SamplerControl<T>,
    sampler: &Sampler<T::Primitive>,
    time: &Time,
    output: &mut Vec<(f32, T::Channel, T::Primitive)>,
) where
    T: AnimationSampling,
{
    use resources::ControlState::*;

    let (new_state, new_end) = update_duration_and_check(&control, sampler, time);

    // If a new end condition has been computed, update in control state
    if let Some(end) = new_end {
        control.end = end;
    }

    // Do sampling
    match new_state {
        Running(duration) | Paused(duration) => {
            output.push((
                control.blend_weight,
                control.channel.clone(),
                sampler.function.interpolate(
                    duration_to_secs(duration),
                    &sampler.input,
                    &sampler.output,
                    false,
                ),
            ));
        }
        Done => {
            if let EndControl::Normal = control.end {
                output.push((control.blend_weight, control.channel.clone(), control.after));
            }
            if let EndControl::Stay = control.end {
                let last_frame = sampler.input.last().cloned().unwrap_or(0.);

                output.push((
                    control.blend_weight,
                    control.channel.clone(),
                    sampler.function.interpolate(
                        last_frame,
                        &sampler.input,
                        &sampler.output,
                        false,
                    ),
                ));
            }
        }
        _ => {}
    }

    // Update state for next iteration
    control.state = new_state;
}
/// Process a single `SamplerControl` object.
///
/// ## Parameters:
///
/// - `control`: sampler control object
/// - `sampler`: the sampler reference from the control object
/// - `component`: the component to update
/// - `now`: synchronized `Instant` for the current frame
Process a single `SamplerControl` object.
Process a single ` SamplerControl ` object .
fn process_sampler<T>(
    control: &mut SamplerControl<T>,
    sampler: &Sampler<T::Primitive>,
    time: &Time,
    output: &mut Vec<(f32, T::Channel, T::Primitive)>,
) where
    T: AnimationSampling,
{
    use resources::ControlState::*;
    let (new_state, new_end) = update_duration_and_check(&control, sampler, time);
    // If a new end condition has been computed, update in control state
    if let Some(end) = new_end {
        control.end = end;
    }
    // Do sampling
    match new_state {
        Running(duration) | Paused(duration) => {
            output.push((
                control.blend_weight,
                control.channel.clone(),
                sampler.function.interpolate(
                    duration_to_secs(duration),
                    &sampler.input,
                    &sampler.output,
                    false,
                ),
            ));
        }
        Done => {
            if let EndControl::Normal = control.end {
                output.push((control.blend_weight, control.channel.clone(), control.after));
            }
            if let EndControl::Stay = control.end {
                let last_frame = sampler.input.last().cloned().unwrap_or(0.);
                output.push((
                    control.blend_weight,
                    control.channel.clone(),
                    sampler.function.interpolate(
                        last_frame,
                        &sampler.input,
                        &sampler.output,
                        false,
                    ),
                ));
            }
        }
        _ => {}
    }
    // Update state for next iteration
    control.state = new_state;
}
fn process_sampler < T > ( control : & mut SamplerControl < T > , sampler : & Sampler < T :: Primitive > , time : & Time , output : & mut Vec < ( f32 , T :: Channel , T :: Primitive ) > , ) where T : AnimationSampling , { use resources :: ControlState :: * ; let ( new_state , new_end ) = update_duration_and_check ( & control , sampler , time ) ; // If a new end condition has been computed, update in control state if let Some ( end ) = new_end { control . end = end ; } // Do sampling match new_state { Running ( duration ) | Paused ( duration ) => { output . push ( ( control . blend_weight , control . channel . clone ( ) , sampler . function . interpolate ( duration_to_secs ( duration ) , & sampler . input , & sampler . output , false , ) , ) ) ; } Done => { if let EndControl :: Normal = control . end { output . push ( ( control . blend_weight , control . channel . clone ( ) , control . after ) ) ; } if let EndControl :: Stay = control . end { let last_frame = sampler . input . last ( ) . cloned ( ) . unwrap_or ( 0. ) ; output . push ( ( control . blend_weight , control . channel . clone ( ) , sampler . function . interpolate ( last_frame , & sampler . input , & sampler . output , false , ) , ) ) ; } } _ => { } } // Update state for next iteration control . state = new_state ; }
Process a single `SamplerControl` object.
Process a single ` SamplerControl ` object .
control
&mut SamplerControl<T>
sampler
&Sampler<T::Primitive>
time
&Time
output
&mut Vec<(f32, T::Channel, T::Primitive)>
control
&mut SamplerControl<T>
sampler
&Sampler<T::Primitive>
time
&Time
output
&mut Vec<(f32, T::Channel, T::Primitive)>
parameters:
`control`: sampler control object
`sampler`: the sampler reference from the control object
`component`: the component to update
`now`: synchronized `Instant` for the current frame
` control ` : sampler control object ` sampler ` : the sampler reference from the control object ` component ` : the component to update ` now ` : synchronized ` Instant ` for the current frame