mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-10-24 18:00:54 +00:00
Added FrameTime. (#3521)
This commit is contained in:
committed by
GitHub
parent
9d63c39a44
commit
3ddf1ed032
@@ -241,7 +241,7 @@ public:
|
||||
&& bgfx::isTextureValid(0, false, 1, bgfx::TextureFormat::R16F, BGFX_TEXTURE_RT)
|
||||
;
|
||||
|
||||
m_timeOffset = bx::getHPCounter();
|
||||
m_frameTime.reset();
|
||||
}
|
||||
|
||||
int shutdown() override
|
||||
@@ -275,6 +275,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)
|
||||
@@ -345,10 +348,6 @@ public:
|
||||
bgfx::setViewRect(0, 0, 0, uint16_t(m_width), uint16_t(m_height) );
|
||||
bgfx::setViewRect(1, 0, 0, uint16_t(m_width), uint16_t(m_height) );
|
||||
|
||||
int64_t now = bx::getHPCounter();
|
||||
const double freq = double(bx::getHPFrequency() );
|
||||
float time = (float)( (now-m_timeOffset)/freq);
|
||||
|
||||
// Reference(s):
|
||||
// - Weighted, Blended Order-Independent Transparency
|
||||
// https://web.archive.org/save/http://jcgt.org/published/0002/02/09/
|
||||
@@ -532,8 +531,6 @@ public:
|
||||
|
||||
entry::MouseState m_mouseState;
|
||||
|
||||
int64_t m_timeOffset;
|
||||
|
||||
bgfx::VertexBufferHandle m_vbh;
|
||||
bgfx::IndexBufferHandle m_ibh;
|
||||
|
||||
@@ -549,6 +546,8 @@ public:
|
||||
|
||||
bgfx::TextureHandle m_fbtextures[2];
|
||||
bgfx::FrameBufferHandle m_fbh;
|
||||
|
||||
FrameTime m_frameTime;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user