Browse Source

Camera: Clean up.

Mr.doob 8 years ago
parent
commit
4b98e92124
1 changed files with 27 additions and 25 deletions
  1. 27 25
      src/cameras/Camera.js

+ 27 - 25
src/cameras/Camera.js

@@ -1,14 +1,14 @@
-import { Matrix4 } from '../math/Matrix4';
-import { Quaternion } from '../math/Quaternion';
-import { Object3D } from '../core/Object3D';
-import { Vector3 } from '../math/Vector3';
-
 /**
  * @author mrdoob / http://mrdoob.com/
  * @author mikael emtinger / http://gomo.se/
  * @author WestLangley / http://github.com/WestLangley
 */
 
+import { Matrix4 } from '../math/Matrix4';
+import { Quaternion } from '../math/Quaternion';
+import { Object3D } from '../core/Object3D';
+import { Vector3 } from '../math/Vector3';
+
 function Camera() {
 
 	Object3D.call( this );
@@ -20,43 +20,45 @@ function Camera() {
 
 }
 
-Camera.prototype = Object.create( Object3D.prototype );
-Camera.prototype.constructor = Camera;
+Camera.prototype = Object.assign( Object.create( Object3D.prototype ), {
+
+	constructor: Camera,
 
-Camera.prototype.isCamera = true;
+	isCamera: true,
 
-Camera.prototype.getWorldDirection = function () {
+	copy: function ( source ) {
 
-	var quaternion = new Quaternion();
+		Object3D.prototype.copy.call( this, source );
 
-	return function getWorldDirection( optionalTarget ) {
+		this.matrixWorldInverse.copy( source.matrixWorldInverse );
+		this.projectionMatrix.copy( source.projectionMatrix );
 
-		var result = optionalTarget || new Vector3();
+		return this;
 
-		this.getWorldQuaternion( quaternion );
+	},
 
-		return result.set( 0, 0, - 1 ).applyQuaternion( quaternion );
+	getWorldDirection: function () {
 
-	};
+		var quaternion = new Quaternion();
 
-}();
+		return function getWorldDirection( optionalTarget ) {
 
-Camera.prototype.clone = function () {
+			var result = optionalTarget || new Vector3();
 
-	return new this.constructor().copy( this );
+			this.getWorldQuaternion( quaternion );
 
-};
+			return result.set( 0, 0, - 1 ).applyQuaternion( quaternion );
 
-Camera.prototype.copy = function ( source ) {
+		};
 
-	Object3D.prototype.copy.call( this, source );
+	}(),
 
-	this.matrixWorldInverse.copy( source.matrixWorldInverse );
-	this.projectionMatrix.copy( source.projectionMatrix );
+	clone: function () {
 
-	return this;
+		return new this.constructor().copy( this );
 
-};
+	}
 
+} );
 
 export { Camera };