Fix FPS calculation

This commit is contained in:
JeremyStar™ 2024-11-25 02:29:00 +01:00
parent d6d890b259
commit 485b813853
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D

View file

@ -203,7 +203,7 @@ public final class Renderer {
bgfx_dbg_text_printf(0, 0, 0x0f, "Time: " + NumberUtil.padNumbers(LocalTime.now().getHour(), 2) + ":" + NumberUtil.padNumbers(LocalTime.now().getMinute(), 2) + ":" + NumberUtil.padNumbers(LocalTime.now().getSecond(), 2));
bgfx_dbg_text_printf(0, 1, 0x0f, "Frames: " + Renderer.getFrameCount());
bgfx_dbg_text_printf(0, 2, 0x0f, "Frames/s: " + Renderer.getFramesPerSecond());
bgfx_dbg_text_printf(0, 3, 0x0f, "Delta: " + Renderer.getDeltaTime());
bgfx_dbg_text_printf(0, 3, 0x0f, "Delta: " + Renderer.getDeltaTime() + "s");
bgfx_dbg_text_printf(0, 4, 0x0f, "V-Sync mode: " + RenderingSubsystemConfiguration.getInstance().getVsyncMode().name());
bgfx_dbg_text_printf(0, 6, 0x0f, "Rendering time:");
for (String item : lastFrameTime.keySet()) {
@ -366,7 +366,7 @@ public final class Renderer {
// Perform per-second operations
if (System.currentTimeMillis() >= timesPSO) {
// Calculate FPS count
framesPerSecond = 1 / deltaTime;
framesPerSecond = 1 / NumberUtil.calculateMeanDouble(deltaTimes);
// Log frame count
if (RenderingSubsystemConfiguration.getInstance().isDebugFrames())