mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-17 20:52:36 +01:00
Added FrameTime. (#3521)
This commit is contained in:
committed by
GitHub
parent
9d63c39a44
commit
3ddf1ed032
@@ -327,6 +327,8 @@ public:
|
||||
m_havePrevious = false;
|
||||
|
||||
imguiCreate();
|
||||
|
||||
m_frameTime.reset();
|
||||
}
|
||||
|
||||
int32_t shutdown() override
|
||||
@@ -375,6 +377,9 @@ public:
|
||||
{
|
||||
if (!entry::processEvents(m_width, m_height, m_debug, m_reset, &m_mouseState) )
|
||||
{
|
||||
m_frameTime.frame();
|
||||
const float deltaTime = bx::toSeconds<float>(m_frameTime.getDeltaTime() );
|
||||
|
||||
// skip processing when minimized, otherwise crashing
|
||||
if (0 == m_width
|
||||
|| 0 == m_height)
|
||||
@@ -382,13 +387,6 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
// Update frame timer
|
||||
int64_t now = bx::getHPCounter();
|
||||
static int64_t last = now;
|
||||
const int64_t frameTime = now - last;
|
||||
last = now;
|
||||
const double freq = double(bx::getHPFrequency() );
|
||||
const float deltaTime = float(frameTime / freq);
|
||||
const bgfx::Caps* caps = bgfx::getCaps();
|
||||
|
||||
if (m_size[0] != (int32_t)m_width
|
||||
@@ -1113,6 +1111,8 @@ public:
|
||||
bool m_enableTxaa = false;
|
||||
bool m_applyMitchellFilter = true;
|
||||
bool m_useTxaaSlow = false;
|
||||
|
||||
FrameTime m_frameTime;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user