Skip to content

Commit

Permalink
Merge pull request #1333 from actnwit/fix/camera-component
Browse files Browse the repository at this point in the history
fix: projection matrix
  • Loading branch information
emadurandal authored May 17, 2024
2 parents e26a0cc + ebd512b commit 88f57c5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/foundation/components/Camera/CameraComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -521,12 +521,12 @@ export class CameraComponent extends Component {
this._projectionMatrix.m20 = 0;
this._projectionMatrix.m21 = 0;
if (zFar === Infinity) {
this._projectionMatrix.m22 = -1;
this._projectionMatrix.m23 = -zNear;
} else {
const nf = 1 / (zNear - zFar);
this._projectionMatrix.m22 = zFar * nf;
this._projectionMatrix.m23 = zFar * zNear * nf;
} else {
this._projectionMatrix.m22 = -1;
this._projectionMatrix.m23 = -zNear;
}
this._projectionMatrix.m30 = 0;
this._projectionMatrix.m31 = 0;
Expand Down Expand Up @@ -598,12 +598,12 @@ export class CameraComponent extends Component {
this._projectionMatrix.m20 = 0;
this._projectionMatrix.m21 = 0;
if (zFar === Infinity) {
this._projectionMatrix.m22 = -1;
this._projectionMatrix.m23 = -2 * zNear;
} else {
const nf = 1 / (zNear - zFar);
this._projectionMatrix.m22 = (zFar + zNear) * nf;
this._projectionMatrix.m23 = 2.0 * zFar * zNear * nf;
} else {
this._projectionMatrix.m22 = -1;
this._projectionMatrix.m23 = -2 * zNear;
}
this._projectionMatrix.m30 = 0;
this._projectionMatrix.m31 = 0;
Expand Down

0 comments on commit 88f57c5

Please sign in to comment.