Skip to content

Commit

Permalink
Factor in deltaTime when computing camera trimming
Browse files Browse the repository at this point in the history
  • Loading branch information
themikelester committed Dec 24, 2024
1 parent c423902 commit 36ea3f8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/ZeldaWindWaker/Main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 36ea3f8

Please sign in to comment.