ezEngine  Release 25.03
ezDefaultTimeStepSmoothing Class Reference

Implements a simple time step smoothing algorithm. More...

#include <DefaultTimeStepSmoothing.h>

Inheritance diagram for ezDefaultTimeStepSmoothing:

Public Member Functions

virtual ezTime GetSmoothedTimeStep (ezTime rawTimeStep, const ezClock *pClock) override
 The function to override to implement time step smoothing. More...
 
virtual void Reset (const ezClock *pClock) override
 Called when ezClock::Reset(), ezClock::Load() or ezClock::SetPaused(true) was called. More...
 
void SetLerpFactor (float f)
 Changes the factor with which to lerp from the last used time step to the new average time step. Default is 0.2. More...
 

Detailed Description

Implements a simple time step smoothing algorithm.

The description for the algorithm was taken from here: http://bitsquid.blogspot.de/2010/10/time-step-smoothing.html

This class implements that algorithm pretty much verbatim. It does not implement keeping track of the time dept and paying that off later, though.

Member Function Documentation

◆ GetSmoothedTimeStep()

ezTime ezDefaultTimeStepSmoothing::GetSmoothedTimeStep ( ezTime  rawTimeStep,
const ezClock pClock 
)
overridevirtual

The function to override to implement time step smoothing.

Parameters
RawTimeStepThe actual raw time difference since the last clock update without any modification.
pClockThe clock that calls this time step smoother. Can be used to look up the clock speed and min/max time step.
Note
It is the responsibility of each ezTimeStepSmoothing class to implement clock speed and also to clamp the time step to the min/max values. This allows the smoothing algorithm to override these values, if necessary.

Implements ezTimeStepSmoothing.

◆ Reset()

void ezDefaultTimeStepSmoothing::Reset ( const ezClock pClock)
overridevirtual

Called when ezClock::Reset(), ezClock::Load() or ezClock::SetPaused(true) was called.

Parameters
pClockThe clock that is calling this function.

Implements ezTimeStepSmoothing.

◆ SetLerpFactor()

void ezDefaultTimeStepSmoothing::SetLerpFactor ( float  f)
inline

Changes the factor with which to lerp from the last used time step to the new average time step. Default is 0.2.

A value of 1.0 would mean that the new average time step is used immediately. The lower the value the more slowly the time step will change from its previous value to the new average value, thus smoothing the time step even more.


The documentation for this class was generated from the following files: