XII Release 0.1.0
Loading...
Searching...
No Matches
xiiDefaultTimeStepSmoothing Class Reference

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

#include <DefaultTimeStepSmoothing.h>

Inheritance diagram for xiiDefaultTimeStepSmoothing:
[legend]

Public Member Functions

virtual xiiTime GetSmoothedTimeStep (xiiTime rawTimeStep, const xiiClock *pClock) override
 The function to override to implement time step smoothing.
 
virtual void Reset (const xiiClock *pClock) override
 Called when xiiClock::Reset(), xiiClock::Load() or xiiClock::SetPaused(true) was called.
 
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.
 

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()

xiiTime xiiDefaultTimeStepSmoothing::GetSmoothedTimeStep ( xiiTime rawTimeStep,
const xiiClock * 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 xiiTimeStepSmoothing 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 xiiTimeStepSmoothing.

◆ Reset()

void xiiDefaultTimeStepSmoothing::Reset ( const xiiClock * pClock)
overridevirtual

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

Parameters
pClockThe clock that is calling this function.

Implements xiiTimeStepSmoothing.

◆ SetLerpFactor()

void xiiDefaultTimeStepSmoothing::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: