From cb5b495ca6e5e6ba914b80ed9d51f176604f0284 Mon Sep 17 00:00:00 2001 From: Mike Lester Date: Tue, 24 Dec 2024 08:32:57 -0700 Subject: [PATCH] Fix camera not being able to move. Remove redundant camera updates --- src/ZeldaWindWaker/Main.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/ZeldaWindWaker/Main.ts b/src/ZeldaWindWaker/Main.ts index 8c98df44b..2dad9e763 100644 --- a/src/ZeldaWindWaker/Main.ts +++ b/src/ZeldaWindWaker/Main.ts @@ -223,11 +223,10 @@ export class dCamera_c extends Camera { private static trimHeightCinematic = 65.0; public finishSetup(): void { - mat4.invert(this.worldMatrix, this.viewMatrix); - mat4.mul(this.clipFromWorldMatrix, this.projectionMatrix, this.viewMatrix); + mat4.invert(this.viewMatrix, this.worldMatrix); + this.setClipPlanes(this.near, this.far); getMatrixTranslation(this.cameraPos, this.worldMatrix); getMatrixAxisZ(this.cameraFwd, this.viewMatrix); - this.frustum.updateClipFrustum(this.clipFromWorldMatrix, this.clipSpaceNearZ); } public setupFromCamera(camera: Camera): void { @@ -235,7 +234,7 @@ export class dCamera_c extends Camera { this.aspect = camera.aspect; this.fovY = camera.fovY; - mat4.copy(this.viewMatrix, camera.viewMatrix); + mat4.copy(this.worldMatrix, camera.worldMatrix); mat4.copy(this.projectionMatrix, camera.projectionMatrix); } @@ -272,7 +271,6 @@ export class dCamera_c extends Camera { if (demoCam.flags & EDemoCamFlags.HasNearZ) { this.near = demoCam.projNear; } if (demoCam.flags & EDemoCamFlags.HasFarZ) { this.far = demoCam.projFar; } - // TODO: Clean this up mat4.targetTo(this.worldMatrix, this.cameraPos, targetPos, this.cameraUp); mat4.rotateZ(this.worldMatrix, this.worldMatrix, this.roll); @@ -283,9 +281,6 @@ export class dCamera_c extends Camera { globals.context.inputManager.isMouseEnabled = true; } - // TODO: Clean this up - this.worldMatrixUpdated(); - this.setClipPlanes(this.near, this.far); this.finishSetup(); // From dCamera_c::CalcTrimSize()