Plasma Engine  2.0
Loading...
Searching...
No Matches
DefaultTimeStepSmoothing.h
1#pragma once
2
3#include <Foundation/Basics.h>
4#include <Foundation/Containers/StaticRingBuffer.h>
5#include <Foundation/Time/Clock.h>
6
14class PL_FOUNDATION_DLL plDefaultTimeStepSmoothing : public plTimeStepSmoothing
15{
16public:
18
19 virtual plTime GetSmoothedTimeStep(plTime rawTimeStep, const plClock* pClock) override;
20
21 virtual void Reset(const plClock* pClock) override;
22
27 void SetLerpFactor(float f) { m_fLerpFactor = f; }
28
29private:
30 float m_fLerpFactor;
31 plTime m_LastTimeStepTaken;
32 plStaticRingBuffer<plTime, 11> m_LastTimeSteps;
33};
A clock that can be speed up, slowed down, paused, etc. Useful for updating game logic,...
Definition Clock.h:15
Implements a simple time step smoothing algorithm.
Definition DefaultTimeStepSmoothing.h:15
void SetLerpFactor(float f)
Changes the factor with which to lerp from the last used time step to the new average time step....
Definition DefaultTimeStepSmoothing.h:27
A ring-buffer container that will use a static array of a given capacity to cycle through elements.
Definition StaticRingBuffer.h:10
Base class for all time step smoothing algorithms.
Definition Clock.h:175
virtual void Reset(const plClock *pClock)=0
Called when plClock::Reset(), plClock::Load() or plClock::SetPaused(true) was called.
virtual plTime GetSmoothedTimeStep(plTime rawTimeStep, const plClock *pClock)=0
The function to override to implement time step smoothing.
The time class encapsulates a double value storing the time in seconds.
Definition Time.h:12