Browse Source

Use copy for PerspectiveCamera and OrthographicCamera to clone/copy attributes

Daniel Hritzkiv 10 years ago
parent
commit
db769897c9
2 changed files with 12 additions and 14 deletions
  1. 7 7
      src/cameras/OrthographicCamera.js
  2. 5 7
      src/cameras/PerspectiveCamera.js

+ 7 - 7
src/cameras/OrthographicCamera.js

@@ -36,17 +36,17 @@ THREE.OrthographicCamera.prototype.updateProjectionMatrix = function () {
 
 };
 
-THREE.OrthographicCamera.prototype.clone = function () {
-
-	var camera = new this.constructor( this.left, this.right, this.top, this.bottom, this.near, this.far );
-	return camera.copy( this );
-
-};
-
 THREE.OrthographicCamera.prototype.copy = function ( source ) {
 	
 	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;
+	
 	this.zoom = source.zoom;
 	
 	return this;

+ 5 - 7
src/cameras/PerspectiveCamera.js

@@ -122,17 +122,15 @@ THREE.PerspectiveCamera.prototype.updateProjectionMatrix = function () {
 
 };
 
-THREE.PerspectiveCamera.prototype.clone = function () {
-
-	var camera = new this.constructor( this.fov, this.aspect, this.near, this.far );
-	return camera.copy( this );
-
-};
-
 THREE.PerspectiveCamera.prototype.copy = function ( source ) {
 	
 	THREE.Camera.prototype.copy.call( this, source );
 	
+	this.fov = source.fov;
+	this.aspect = source.aspect;
+	this.near = source.near;
+	this.far = source.far;
+	
 	this.zoom = source.zoom;
 	
 	return this;