diff --git a/app.js b/app.js index 045e5b0..60689a0 100644 --- a/app.js +++ b/app.js @@ -951,15 +951,15 @@ function gameLoop() { } // Render - renderer.info.reset(); composer.render(); - // Debug overlay + // Debug overlay (read AFTER render so counts are populated) frameCount++; - if (performance.now() - lastFPSTime >= 1000) { + const now = performance.now(); + if (now - lastFPSTime >= 1000) { fps = frameCount; frameCount = 0; - lastFPSTime = performance.now(); + lastFPSTime = now; } if (debugOverlay) { const info = renderer.info; @@ -967,6 +967,7 @@ function gameLoop() { `FPS: ${fps} Draw: ${info.render?.calls} Tri: ${info.render?.triangles}\n` + `Pos: ${playerPos.x.toFixed(1)}, ${playerPos.y.toFixed(1)}, ${playerPos.z.toFixed(1)}`; } + renderer.info.reset(); } // ═══ RESIZE ═══