Added FrameTime. (#3521)

This commit is contained in:
Branimir Karadžić
2025-12-23 20:03:52 -08:00
committed by GitHub
parent 9d63c39a44
commit 3ddf1ed032
47 changed files with 608 additions and 590 deletions

View File

@@ -146,9 +146,9 @@ public:
// Create program from shaders.
m_program = loadProgram("vs_cubes", "fs_cubes");
m_timeOffset = bx::getHPCounter();
imguiCreate();
m_frameTime.reset();
}
virtual int shutdown() override
@@ -177,6 +177,9 @@ public:
{
if (!entry::processEvents(m_width, m_height, m_debug, m_reset, &m_mouseState) )
{
m_frameTime.frame();
const float time = bx::toSeconds<float>(m_frameTime.getDurationTime() );
imguiBeginFrame(m_mouseState.m_mx
, m_mouseState.m_my
, (m_mouseState.m_buttons[entry::MouseButton::Left ] ? IMGUI_MBUT_LEFT : 0)
@@ -191,8 +194,6 @@ public:
imguiEndFrame();
float time = (float)( (bx::getHPCounter()-m_timeOffset)/double(bx::getHPFrequency() ) );
const bx::Vec3 at = { 0.0f, 0.0f, 0.0f };
const bx::Vec3 eye = { 0.0f, 0.0f, -35.0f };
@@ -280,7 +281,8 @@ public:
bgfx::DynamicVertexBufferHandle m_vbh[kDimWidth*kDimHeight];
bgfx::DynamicIndexBufferHandle m_ibh;
bgfx::ProgramHandle m_program;
int64_t m_timeOffset;
FrameTime m_frameTime;
};
} // namespace