mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-09 04:27:42 +00:00
FPS Counter and debug overlay CVAR
This commit is contained in:
@@ -34,6 +34,9 @@ SViewport g_Viewport = {
|
||||
0, 0, 640, 480, 640 / 2.f, 480 / 2.f, 0.0f,
|
||||
};
|
||||
u32 CGraphics::g_FrameCounter = 0;
|
||||
u32 CGraphics::g_Framerate = 0;
|
||||
u32 CGraphics::g_FramesPast = 0;
|
||||
frame_clock::time_point CGraphics::g_FrameStartTime = frame_clock::now();
|
||||
|
||||
const std::array<zeus::CMatrix3f, 6> CGraphics::skCubeBasisMats{{
|
||||
/* Right */
|
||||
@@ -126,6 +129,8 @@ void CGraphics::EndScene() {
|
||||
CLineRenderer::UpdateBuffers();
|
||||
|
||||
++g_FrameCounter;
|
||||
|
||||
UpdateFPSCounter();
|
||||
}
|
||||
|
||||
void CGraphics::SetAlphaCompare(ERglAlphaFunc comp0, u8 ref0, ERglAlphaOp op, ERglAlphaFunc comp1, u8 ref1) {}
|
||||
@@ -444,6 +449,18 @@ void CGraphics::TickRenderTimings() {
|
||||
g_DefaultSeconds = g_RenderTimings / 60.f;
|
||||
}
|
||||
|
||||
static constexpr u64 FPS_REFRESH_RATE = 1000;
|
||||
void CGraphics::UpdateFPSCounter() {
|
||||
++g_FramesPast;
|
||||
|
||||
std::chrono::duration<double, std::milli> timeElapsed = frame_clock::now() - g_FrameStartTime;
|
||||
if (timeElapsed.count() > FPS_REFRESH_RATE) {
|
||||
g_Framerate = g_FramesPast;
|
||||
g_FrameStartTime = frame_clock::now();
|
||||
g_FramesPast = 0;
|
||||
}
|
||||
}
|
||||
|
||||
boo::IGraphicsDataFactory::Platform CGraphics::g_BooPlatform = boo::IGraphicsDataFactory::Platform::Null;
|
||||
boo::IGraphicsDataFactory* CGraphics::g_BooFactory = nullptr;
|
||||
boo::IGraphicsCommandQueue* CGraphics::g_BooMainCommandQueue = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user