From 36ea3f8d70cd527959b71f9cd94220f6ffe6b725 Mon Sep 17 00:00:00 2001 From: Mike Lester Date: Tue, 24 Dec 2024 08:46:14 -0700 Subject: [PATCH] Factor in deltaTime when computing camera trimming --- src/ZeldaWindWaker/Main.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ZeldaWindWaker/Main.ts b/src/ZeldaWindWaker/Main.ts index 05228f716..68fd8a7b9 100644 --- a/src/ZeldaWindWaker/Main.ts +++ b/src/ZeldaWindWaker/Main.ts @@ -18,7 +18,7 @@ import { J3DModelInstance } from '../Common/JSYSTEM/J3D/J3DGraphBase.js'; import * as JPA from '../Common/JSYSTEM/JPA.js'; import { BTIData } from '../Common/JSYSTEM/JUTTexture.js'; import { dfRange } from '../DebugFloaters.js'; -import { MathConstants, getMatrixAxisZ, getMatrixTranslation, range } from '../MathHelpers.js'; +import { MathConstants, clamp, getMatrixAxisZ, getMatrixTranslation, range } from '../MathHelpers.js'; import { SceneContext } from '../SceneBase.js'; import { TextureMapping } from '../TextureHolder.js'; import { setBackbufferDescSimple, standardFullClearRenderPassDescriptor } from '../gfx/helpers/RenderGraphHelpers.js'; @@ -285,11 +285,12 @@ export class dCamera_c extends Camera { this.finishSetup(); // From dCamera_c::CalcTrimSize() - // Animate up to the trim size for the current mode. + // Animate up to the trim size for the current mode (even when paused) + const deltaTimeFrames = clamp(viewerInput.deltaTime / 1000 * 30, 0.5, 1); if (this.cameraMode === CameraMode.Cinematic) { - this.trimHeight += (dCamera_c.trimHeightCinematic - this.trimHeight) * 0.25; + this.trimHeight += (dCamera_c.trimHeightCinematic - this.trimHeight) * 0.25 * deltaTimeFrames; } else { - this.trimHeight += -this.trimHeight * 0.25; + this.trimHeight += -this.trimHeight * 0.25 * deltaTimeFrames; } const trimPx = (this.trimHeight / 480) * viewerInput.backbufferHeight;