Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
LoopTimingData.cpp
Go to the documentation of this file.
1
2
4
5namespace Divide
6{
7 F32 LoopTimingData::alpha() const noexcept
8 {
9 const F32 diff = Time::MicrosecondsToMilliseconds<F32>( _accumulator ) / Time::MicrosecondsToMilliseconds<F32>( FIXED_UPDATE_RATE_US );
10 return _freezeGameTime ? 1.f : CLAMPED_01( diff );
11 }
12
13 void LoopTimingData::update( const U64 elapsedTimeUSApp, const U64 fixedGameTickDurationUS ) noexcept
14 {
15 _updateLoops = 0u;
16
17 _gameTimeDeltaUS = _freezeGameTime ? 0u : fixedGameTickDurationUS;
18 _gameCurrentTimeUS += _gameTimeDeltaUS;
19
20 // In case we break in the debugger
21 _appTimeDeltaUS = elapsedTimeUSApp - _appCurrentTimeUS;
22 _appCurrentTimeUS += _appTimeDeltaUS;
23 _appTimeDeltaUS = std::min( _appTimeDeltaUS, MAX_FRAME_TIME_US);
24
25 _accumulator += _appTimeDeltaUS;
26 }
27
28} //namespace Divide
Handle console commands that start with a forward slash.
Definition: AIProcessor.cpp:7
constexpr U64 MAX_FRAME_TIME_US
uint64_t U64
::value constexpr T CLAMPED_01(T n) noexcept
Definition: MathHelper.inl:134
constexpr U64 FIXED_UPDATE_RATE_US
F32 alpha() const noexcept
void update(U64 elapsedTimeUSApp, U64 fixedGameTickDurationUS) noexcept