not bad
This commit is contained in:
parent
2741b93dea
commit
434f07cc4e
103 changed files with 8387 additions and 8152 deletions
|
|
@ -78,16 +78,22 @@ function loop() {
|
|||
const rawDt = t - last;
|
||||
const dt = clamp(rawDt, 0, 0.05);
|
||||
last = t;
|
||||
window.TarinaiPerf?.beginFrame?.();
|
||||
fpsTimer += rawDt;
|
||||
fpsFrames += 1;
|
||||
if (fpsTimer >= 0.5) {
|
||||
window.__tarinaiFps = Math.round(fpsFrames / Math.max(fpsTimer, 0.001));
|
||||
window.TarinaiPerformance?.updateFps?.(window.__tarinaiFps);
|
||||
fpsTimer = 0;
|
||||
fpsFrames = 0;
|
||||
}
|
||||
const endUpdate = window.TarinaiPerf?.begin?.("update.total") || null;
|
||||
world.update(dt);
|
||||
if (endUpdate) endUpdate();
|
||||
const endRender = window.TarinaiPerf?.begin?.("render.total") || null;
|
||||
render();
|
||||
if (endRender) endRender();
|
||||
window.TarinaiPerf?.endFrame?.(rawDt, window.__tarinaiFps || 0);
|
||||
if (window.TarinaiPerf?.consumeResizeRequest?.() && typeof resizeCanvas === "function") resizeCanvas();
|
||||
statsTimer += dt;
|
||||
const statsInterval = 2.5;
|
||||
if (statsTimer > statsInterval) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue