Skip to content

Commit

Permalink
Fix camera not being able to move. Remove redundant camera updates
Browse files Browse the repository at this point in the history
  • Loading branch information
themikelester committed Dec 24, 2024
1 parent 9b80db4 commit cb5b495
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/ZeldaWindWaker/Main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,19 +223,18 @@ 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 {
this.clipSpaceNearZ = camera.clipSpaceNearZ;
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);
}

Expand Down Expand Up @@ -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);

Expand All @@ -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()
Expand Down

0 comments on commit cb5b495

Please sign in to comment.