Skip to content

Commit

Permalink
feat(cameras): OrthographicCamera
Browse files Browse the repository at this point in the history
  • Loading branch information
sakitam-fdd committed May 22, 2022
1 parent 649b8ec commit 22a7771
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/cameras/OrthographicCamera.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import Camera from './Camera';

export default class OrthographicCamera extends Camera {
constructor(left, right, top, bottom, near, far, zoom = 1) {
super({
bounds: {
left,
right,
top,
bottom,
},
near,
far,
zoom,
});
}

updateProjectionMatrix() {
const {
left,
right,
top,
bottom,
} = this.bounds;
const { zoom } = this;
this.projectionMatrix.orthographic(
left / zoom,
right / zoom,
top / zoom,
bottom / zoom,
this.near,
this.far,
);
}
}

0 comments on commit 22a7771

Please sign in to comment.