/
redgpu
/
ezEngine
Обзор
Документация
Войти
/
redgpu
/
ezEngine
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
Code/Engine/Foundation/Time/DefaultTimeStepSmoothing.h
33 строки
1 KB
Ingrater
Implement parameter coding guidelines in clang-tidy (#808)
18 фев 2023, 13:18
Не верифицирован
18 фев 2023, 13:18
3c98d47
Код
Авторство
О чём код?
#pragma once #include <Foundation/Basics.h> #include <Foundation/Containers/StaticRingBuffer.h> #include <Foundation/Time/Clock.h> /// \brief 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. class EZ_FOUNDATION_DLL ezDefaultTimeStepSmoothing : public ezTimeStepSmoothing { public: ezDefaultTimeStepSmoothing(); virtual ezTime GetSmoothedTimeStep(ezTime rawTimeStep, const ezClock* pClock) override; virtual void Reset(const ezClock* pClock) override; /// \brief 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. void SetLerpFactor(float f) { m_fLerpFactor = f; } private: float m_fLerpFactor; ezTime m_LastTimeStepTaken; ezStaticRingBuffer<ezTime, 11> m_LastTimeSteps; };