10#include "SD/export.hpp"
25 m_frame_time =
now - m_last_time;
28 if (m_frame_time > 0.25)
30 m_accumulator += m_frame_time;
36 m_frame_work_time =
static_cast<float>(
glfwGetTime() - m_work_start) - m_gpu_wait_time;
37 m_gpu_wait_time = 0.0f;
42 if (m_accumulator >= m_fixed_time_step) {
43 m_accumulator -= m_fixed_time_step;
58 double m_last_time = 0.0;
59 double m_accumulator = 0.0;
60 double m_fixed_time_step = 1.0 / 60.0;
61 double m_work_start = 0.0;
62 float m_frame_work_time = 0.0f;
63 float m_gpu_wait_time = 0.0f;
64 double m_frame_time = 0.0;
Tracks frame timing, fixed timestep accumulation, and CPU work time.
Definition FrameTimer.hpp:21
void add_gpu_wait_time(float t)
Definition FrameTimer.hpp:49
void begin()
Definition FrameTimer.hpp:23
void end_work()
Definition FrameTimer.hpp:35
float get_frame_time() const
Definition FrameTimer.hpp:52
bool consume_fixed_step()
Returns true if a fixed step should run. Call in a loop.
Definition FrameTimer.hpp:41
void set_fixed_time_step(double step)
Definition FrameTimer.hpp:55
float get_frame_work_time() const
Definition FrameTimer.hpp:53
void begin_work()
Definition FrameTimer.hpp:33
double get_fixed_time_step() const
Definition FrameTimer.hpp:54
Definition Application.hpp:28
constexpr T g_type_max
Definition types.hpp:21