cione-comp-lib
Version:
`$ yarn add cione-comp-lib` 或者 `$ npm i cione-comp-lib -S`
38 lines (37 loc) • 1.01 kB
JavaScript
import Camera from "../Camera.mjs";
var Orthographic = Camera.extend(
{
left: -1,
right: 1,
near: -1,
far: 1,
top: 1,
bottom: -1
},
{
updateProjectionMatrix: function() {
this.projectionMatrix.ortho(this.left, this.right, this.bottom, this.top, this.near, this.far);
},
decomposeProjectionMatrix: function() {
var m = this.projectionMatrix.array;
this.left = (-1 - m[12]) / m[0];
this.right = (1 - m[12]) / m[0];
this.top = (1 - m[13]) / m[5];
this.bottom = (-1 - m[13]) / m[5];
this.near = -(-1 - m[14]) / m[10];
this.far = -(1 - m[14]) / m[10];
},
clone: function() {
var camera = Camera.prototype.clone.call(this);
camera.left = this.left;
camera.right = this.right;
camera.near = this.near;
camera.far = this.far;
camera.top = this.top;
camera.bottom = this.bottom;
return camera;
}
}
);
var OrthoCamera = Orthographic;
export { OrthoCamera as default };