Skip to content

Commit

Permalink
*Camera: Implemented Object.assign(). See mrdoob#8838.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdoob authored and carlosanunes committed May 18, 2016
1 parent 3081dfa commit 23f53bd
Show file tree
Hide file tree
Showing 3 changed files with 182 additions and 182 deletions.
65 changes: 34 additions & 31 deletions src/cameras/OrthographicCamera.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,49 +22,52 @@ THREE.OrthographicCamera = function ( left, right, top, bottom, near, far ) {

};

THREE.OrthographicCamera.prototype = Object.create( THREE.Camera.prototype );
THREE.OrthographicCamera.prototype.constructor = THREE.OrthographicCamera;
THREE.OrthographicCamera.prototype = Object.assign( Object.create( THREE.Camera.prototype ), {

THREE.OrthographicCamera.prototype.updateProjectionMatrix = function () {
constructor: THREE.OrthographicCamera,

var dx = ( this.right - this.left ) / ( 2 * this.zoom );
var dy = ( this.top - this.bottom ) / ( 2 * this.zoom );
var cx = ( this.right + this.left ) / 2;
var cy = ( this.top + this.bottom ) / 2;
copy: function ( source ) {

this.projectionMatrix.makeOrthographic( cx - dx, cx + dx, cy + dy, cy - dy, this.near, this.far );
THREE.Camera.prototype.copy.call( this, source );

};
this.left = source.left;
this.right = source.right;
this.top = source.top;
this.bottom = source.bottom;
this.near = source.near;
this.far = source.far;

THREE.OrthographicCamera.prototype.copy = function ( source ) {
this.zoom = source.zoom;

THREE.Camera.prototype.copy.call( this, source );
return this;

this.left = source.left;
this.right = source.right;
this.top = source.top;
this.bottom = source.bottom;
this.near = source.near;
this.far = source.far;
},

this.zoom = source.zoom;
updateProjectionMatrix: function () {

return this;
var dx = ( this.right - this.left ) / ( 2 * this.zoom );
var dy = ( this.top - this.bottom ) / ( 2 * this.zoom );
var cx = ( this.right + this.left ) / 2;
var cy = ( this.top + this.bottom ) / 2;

};
this.projectionMatrix.makeOrthographic( cx - dx, cx + dx, cy + dy, cy - dy, this.near, this.far );

THREE.OrthographicCamera.prototype.toJSON = function ( meta ) {
},

var data = THREE.Object3D.prototype.toJSON.call( this, meta );
toJSON: function ( meta ) {

data.object.zoom = this.zoom;
data.object.left = this.left;
data.object.right = this.right;
data.object.top = this.top;
data.object.bottom = this.bottom;
data.object.near = this.near;
data.object.far = this.far;
var data = THREE.Object3D.prototype.toJSON.call( this, meta );

return data;
data.object.zoom = this.zoom;
data.object.left = this.left;
data.object.right = this.right;
data.object.top = this.top;
data.object.bottom = this.bottom;
data.object.near = this.near;
data.object.far = this.far;

};
return data;

}

} );
Loading

0 comments on commit 23f53bd

Please sign in to comment.