浏览代码

Removed re-asigning of constructors.

Mr.doob 12 年之前
父节点
当前提交
f60212b5b0

+ 3 - 5
src/math/Box2.js

@@ -11,8 +11,6 @@ THREE.Box2 = function ( min, max ) {
 
 
 THREE.extend( THREE.Box2.prototype, {
 THREE.extend( THREE.Box2.prototype, {
 
 
-	constructor: THREE.Box2,
-
 	set: function ( min, max ) {
 	set: function ( min, max ) {
 
 
 		this.min.copy( min );
 		this.min.copy( min );
@@ -70,7 +68,7 @@ THREE.extend( THREE.Box2.prototype, {
 	setFromCenterAndSize: function() {
 	setFromCenterAndSize: function() {
 
 
 		var v1 = new THREE.Vector2();
 		var v1 = new THREE.Vector2();
-		
+
 		return function ( center, size ) {
 		return function ( center, size ) {
 
 
 			var halfSize = v1.copy( size ).multiplyScalar( 0.5 );
 			var halfSize = v1.copy( size ).multiplyScalar( 0.5 );
@@ -210,7 +208,7 @@ THREE.extend( THREE.Box2.prototype, {
 	distanceToPoint: function() {
 	distanceToPoint: function() {
 
 
 		var v1 = new THREE.Vector2();
 		var v1 = new THREE.Vector2();
-		
+
 		return function ( point ) {
 		return function ( point ) {
 
 
 			var clampedPoint = v1.copy( point ).clamp( this.min, this.max );
 			var clampedPoint = v1.copy( point ).clamp( this.min, this.max );
@@ -259,4 +257,4 @@ THREE.extend( THREE.Box2.prototype, {
 
 
 	}
 	}
 
 
-} );
+} );

+ 5 - 7
src/math/Box3.js

@@ -11,8 +11,6 @@ THREE.Box3 = function ( min, max ) {
 
 
 THREE.extend( THREE.Box3.prototype, {
 THREE.extend( THREE.Box3.prototype, {
 
 
-	constructor: THREE.Box3,
-
 	set: function ( min, max ) {
 	set: function ( min, max ) {
 
 
 		this.min.copy( min );
 		this.min.copy( min );
@@ -80,7 +78,7 @@ THREE.extend( THREE.Box3.prototype, {
 	setFromCenterAndSize: function() {
 	setFromCenterAndSize: function() {
 
 
 		var v1 = new THREE.Vector3();
 		var v1 = new THREE.Vector3();
-		
+
 		return function ( center, size ) {
 		return function ( center, size ) {
 
 
 			var halfSize = v1.copy( size ).multiplyScalar( 0.5 );
 			var halfSize = v1.copy( size ).multiplyScalar( 0.5 );
@@ -228,7 +226,7 @@ THREE.extend( THREE.Box3.prototype, {
 	distanceToPoint: function() {
 	distanceToPoint: function() {
 
 
 		var v1 = new THREE.Vector3();
 		var v1 = new THREE.Vector3();
-		
+
 		return function ( point ) {
 		return function ( point ) {
 
 
 			var clampedPoint = v1.copy( point ).clamp( this.min, this.max );
 			var clampedPoint = v1.copy( point ).clamp( this.min, this.max );
@@ -241,7 +239,7 @@ THREE.extend( THREE.Box3.prototype, {
 	getBoundingSphere: function() {
 	getBoundingSphere: function() {
 
 
 		var v1 = new THREE.Vector3();
 		var v1 = new THREE.Vector3();
-		
+
 		return function ( optionalTarget ) {
 		return function ( optionalTarget ) {
 
 
 			var result = optionalTarget || new THREE.Sphere();
 			var result = optionalTarget || new THREE.Sphere();
@@ -297,7 +295,7 @@ THREE.extend( THREE.Box3.prototype, {
 			points[5].set( this.max.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 101
 			points[5].set( this.max.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 101
 			points[6].set( this.max.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 110
 			points[6].set( this.max.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 110
 			points[7].set( this.max.x, this.max.y, this.max.z ).applyMatrix4( matrix );  // 111
 			points[7].set( this.max.x, this.max.y, this.max.z ).applyMatrix4( matrix );  // 111
-			
+
 			this.makeEmpty();
 			this.makeEmpty();
 			this.setFromPoints( points );
 			this.setFromPoints( points );
 
 
@@ -328,4 +326,4 @@ THREE.extend( THREE.Box3.prototype, {
 
 
 	}
 	}
 
 
-} );
+} );

+ 0 - 3
src/math/Color.js

@@ -12,11 +12,8 @@ THREE.Color = function ( value ) {
 
 
 THREE.extend( THREE.Color.prototype, {
 THREE.extend( THREE.Color.prototype, {
 
 
-	constructor: THREE.Color,
-
 	r: 1, g: 1, b: 1,
 	r: 1, g: 1, b: 1,
 
 
-
 	set: function ( value ) {
 	set: function ( value ) {
 
 
 		switch ( typeof value ) {
 		switch ( typeof value ) {

+ 2 - 2
src/math/Math.js

@@ -80,7 +80,7 @@ THREE.Math = {
 	}(),
 	}(),
 
 
 	radToDeg: function() {
 	radToDeg: function() {
-		
+
 		var radianToDegreesFactor = 180 / Math.PI;
 		var radianToDegreesFactor = 180 / Math.PI;
 
 
 		return function ( radians ) {
 		return function ( radians ) {
@@ -91,4 +91,4 @@ THREE.Math = {
 
 
 	}()
 	}()
 
 
-};
+};

+ 2 - 4
src/math/Matrix3.js

@@ -19,8 +19,6 @@ THREE.Matrix3 = function ( n11, n12, n13, n21, n22, n23, n31, n32, n33 ) {
 
 
 THREE.extend( THREE.Matrix3.prototype, {
 THREE.extend( THREE.Matrix3.prototype, {
 
 
-	constructor: THREE.Matrix3,
-
 	set: function ( n11, n12, n13, n21, n22, n23, n31, n32, n33 ) {
 	set: function ( n11, n12, n13, n21, n22, n23, n31, n32, n33 ) {
 
 
 		var te = this.elements;
 		var te = this.elements;
@@ -73,7 +71,7 @@ THREE.extend( THREE.Matrix3.prototype, {
 	multiplyVector3Array: function() {
 	multiplyVector3Array: function() {
 
 
 		var v1 = new THREE.Vector3();
 		var v1 = new THREE.Vector3();
-		
+
 		return function ( a ) {
 		return function ( a ) {
 
 
 			for ( var i = 0, il = a.length; i < il; i += 3 ) {
 			for ( var i = 0, il = a.length; i < il; i += 3 ) {
@@ -214,4 +212,4 @@ THREE.extend( THREE.Matrix3.prototype, {
 
 
 	}
 	}
 
 
-} );
+} );

+ 16 - 18
src/math/Matrix4.js

@@ -27,8 +27,6 @@ THREE.Matrix4 = function ( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33
 
 
 THREE.extend( THREE.Matrix4.prototype, {
 THREE.extend( THREE.Matrix4.prototype, {
 
 
-	constructor: THREE.Matrix4,
-
 	set: function ( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {
 	set: function ( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {
 
 
 		var te = this.elements;
 		var te = this.elements;
@@ -213,14 +211,14 @@ THREE.extend( THREE.Matrix4.prototype, {
 
 
 	lookAt: function() {
 	lookAt: function() {
 
 
-		var x = new THREE.Vector3(),
-			y = new THREE.Vector3(),
-			z = new THREE.Vector3();
-		
+		var x = new THREE.Vector3();
+		var y = new THREE.Vector3();
+		var z = new THREE.Vector3();
+
 		return function ( eye, target, up ) {
 		return function ( eye, target, up ) {
 
 
 			var te = this.elements;
 			var te = this.elements;
-		
+
 			z.subVectors( eye, target ).normalize();
 			z.subVectors( eye, target ).normalize();
 
 
 			if ( z.length() === 0 ) {
 			if ( z.length() === 0 ) {
@@ -349,7 +347,7 @@ THREE.extend( THREE.Matrix4.prototype, {
 	multiplyVector3Array: function() {
 	multiplyVector3Array: function() {
 
 
 		var v1 = new THREE.Vector3();
 		var v1 = new THREE.Vector3();
-		
+
 		return function ( a ) {
 		return function ( a ) {
 
 
 			for ( var i = 0, il = a.length; i < il; i += 3 ) {
 			for ( var i = 0, il = a.length; i < il; i += 3 ) {
@@ -511,7 +509,7 @@ THREE.extend( THREE.Matrix4.prototype, {
 	getPosition: function() {
 	getPosition: function() {
 
 
 		var v1 = new THREE.Vector3();
 		var v1 = new THREE.Vector3();
-		
+
 		return function () {
 		return function () {
 
 
 			var te = this.elements;
 			var te = this.elements;
@@ -536,7 +534,7 @@ THREE.extend( THREE.Matrix4.prototype, {
 	getColumnX: function() {
 	getColumnX: function() {
 
 
 		var v1 = new THREE.Vector3();
 		var v1 = new THREE.Vector3();
-		
+
 		return function () {
 		return function () {
 
 
 			var te = this.elements;
 			var te = this.elements;
@@ -549,7 +547,7 @@ THREE.extend( THREE.Matrix4.prototype, {
 	getColumnY: function() {
 	getColumnY: function() {
 
 
 		var v1 = new THREE.Vector3();
 		var v1 = new THREE.Vector3();
-		
+
 		return function () {
 		return function () {
 
 
 			var te = this.elements;
 			var te = this.elements;
@@ -562,7 +560,7 @@ THREE.extend( THREE.Matrix4.prototype, {
 	getColumnZ: function() {
 	getColumnZ: function() {
 
 
 		var v1 = new THREE.Vector3();
 		var v1 = new THREE.Vector3();
-		
+
 		return function() {
 		return function() {
 
 
 			var te = this.elements;
 			var te = this.elements;
@@ -635,7 +633,7 @@ THREE.extend( THREE.Matrix4.prototype, {
 		return function ( translation, rotation, scale ) {
 		return function ( translation, rotation, scale ) {
 
 
 			var te = this.elements;
 			var te = this.elements;
-			
+
 			mRotation.identity();
 			mRotation.identity();
 			mRotation.setRotationFromQuaternion( rotation );
 			mRotation.setRotationFromQuaternion( rotation );
 
 
@@ -659,12 +657,12 @@ THREE.extend( THREE.Matrix4.prototype, {
 			y = new THREE.Vector3(),
 			y = new THREE.Vector3(),
 			z = new THREE.Vector3(),
 			z = new THREE.Vector3(),
 			matrix = new THREE.Matrix4();
 			matrix = new THREE.Matrix4();
-		
+
 		return function ( translation, rotation, scale ) {
 		return function ( translation, rotation, scale ) {
 
 
 			var te = this.elements;
 			var te = this.elements;
 
 
-			// grab the axis vectors		
+			// grab the axis vectors
 			x.set( te[0], te[1], te[2] );
 			x.set( te[0], te[1], te[2] );
 			y.set( te[4], te[5], te[6] );
 			y.set( te[4], te[5], te[6] );
 			z.set( te[8], te[9], te[10] );
 			z.set( te[8], te[9], te[10] );
@@ -682,7 +680,7 @@ THREE.extend( THREE.Matrix4.prototype, {
 			translation.z = te[14];
 			translation.z = te[14];
 
 
 			// scale the rotation part
 			// scale the rotation part
-		
+
 			matrix.copy( this );
 			matrix.copy( this );
 
 
 			matrix.elements[0] /= scale.x;
 			matrix.elements[0] /= scale.x;
@@ -721,7 +719,7 @@ THREE.extend( THREE.Matrix4.prototype, {
 	extractRotation: function() {
 	extractRotation: function() {
 
 
 		var v1 = new THREE.Vector3();
 		var v1 = new THREE.Vector3();
-		
+
 		return function ( m ) {
 		return function ( m ) {
 
 
 			var te = this.elements;
 			var te = this.elements;
@@ -1115,4 +1113,4 @@ THREE.extend( THREE.Matrix4.prototype, {
 
 
 	}
 	}
 
 
-} );
+} );

+ 8 - 10
src/math/Plane.js

@@ -11,8 +11,6 @@ THREE.Plane = function ( normal, constant ) {
 
 
 THREE.extend( THREE.Plane.prototype, {
 THREE.extend( THREE.Plane.prototype, {
 
 
-	constructor: THREE.Plane,
-
 	set: function ( normal, constant ) {
 	set: function ( normal, constant ) {
 
 
 		this.normal.copy( normal );
 		this.normal.copy( normal );
@@ -42,9 +40,9 @@ THREE.extend( THREE.Plane.prototype, {
 
 
 	setFromCoplanarPoints: function() {
 	setFromCoplanarPoints: function() {
 
 
-		var v1 = new THREE.Vector3(),
-			v2 = new THREE.Vector3();
-		
+		var v1 = new THREE.Vector3();
+		var v2 = new THREE.Vector3();
+
 		return function ( a, b, c ) {
 		return function ( a, b, c ) {
 
 
 			var normal = v1.subVectors( c, b ).cross( v2.subVectors( a, b ) ).normalize();
 			var normal = v1.subVectors( c, b ).cross( v2.subVectors( a, b ) ).normalize();
@@ -131,7 +129,7 @@ THREE.extend( THREE.Plane.prototype, {
 	intersectLine: function() {
 	intersectLine: function() {
 
 
 		var v1 = new THREE.Vector3();
 		var v1 = new THREE.Vector3();
-		
+
 		return function ( startPoint, endPoint, optionalTarget ) {
 		return function ( startPoint, endPoint, optionalTarget ) {
 
 
 			var result = optionalTarget || new THREE.Vector3();
 			var result = optionalTarget || new THREE.Vector3();
@@ -178,9 +176,9 @@ THREE.extend( THREE.Plane.prototype, {
 
 
 	transform: function() {
 	transform: function() {
 
 
-		var v1 = new THREE.Vector3(),
-			v2 = new THREE.Vector3();
-		
+		var v1 = new THREE.Vector3();
+		var v2 = new THREE.Vector3();
+
 		return function ( matrix, optionalNormalMatrix ) {
 		return function ( matrix, optionalNormalMatrix ) {
 
 
 			// compute new normal based on theory here:
 			// compute new normal based on theory here:
@@ -219,4 +217,4 @@ THREE.extend( THREE.Plane.prototype, {
 
 
 	}
 	}
 
 
-} );
+} );

+ 0 - 2
src/math/Quaternion.js

@@ -16,8 +16,6 @@ THREE.Quaternion = function( x, y, z, w ) {
 
 
 THREE.extend( THREE.Quaternion.prototype, {
 THREE.extend( THREE.Quaternion.prototype, {
 
 
-	constructor: THREE.Quaternion,
-
 	set: function ( x, y, z, w ) {
 	set: function ( x, y, z, w ) {
 
 
 		this.x = x;
 		this.x = x;

+ 2 - 4
src/math/Ray.js

@@ -11,8 +11,6 @@ THREE.Ray = function ( origin, direction ) {
 
 
 THREE.extend( THREE.Ray.prototype, {
 THREE.extend( THREE.Ray.prototype, {
 
 
-	constructor: THREE.Ray,
-
 	set: function ( origin, direction ) {
 	set: function ( origin, direction ) {
 
 
 		this.origin.copy( origin );
 		this.origin.copy( origin );
@@ -133,7 +131,7 @@ THREE.extend( THREE.Ray.prototype, {
 
 
 		var t = this.distanceToPlane( plane );
 		var t = this.distanceToPlane( plane );
 
 
-		if( t === undefined ) {
+		if ( t === undefined ) {
 
 
 			return undefined;
 			return undefined;
 		}
 		}
@@ -163,4 +161,4 @@ THREE.extend( THREE.Ray.prototype, {
 
 
 	}
 	}
 
 
-} );
+} );

+ 1 - 3
src/math/Sphere.js

@@ -12,8 +12,6 @@ THREE.Sphere = function ( center, radius ) {
 
 
 THREE.extend( THREE.Sphere.prototype, {
 THREE.extend( THREE.Sphere.prototype, {
 
 
-	constructor: THREE.Sphere,
-
 	set: function ( center, radius ) {
 	set: function ( center, radius ) {
 
 
 		this.center.copy( center );
 		this.center.copy( center );
@@ -133,4 +131,4 @@ THREE.extend( THREE.Sphere.prototype, {
 
 
 	}
 	}
 
 
-} );
+} );

+ 4 - 4
src/math/Triangle.js

@@ -128,9 +128,9 @@ THREE.extend( THREE.Triangle.prototype, {
 
 
 	area: function() {
 	area: function() {
 
 
-		var v0 = new THREE.Vector3(),
-			v1 = new THREE.Vector3();
-		
+		var v0 = new THREE.Vector3();
+		var v1 = new THREE.Vector3();
+
 		return function () {
 		return function () {
 
 
 			v0.subVectors( this.c, this.b );
 			v0.subVectors( this.c, this.b );
@@ -187,4 +187,4 @@ THREE.extend( THREE.Triangle.prototype, {
 
 
 	}
 	}
 
 
-} );
+} );

+ 1 - 3
src/math/Vector2.js

@@ -14,8 +14,6 @@ THREE.Vector2 = function ( x, y ) {
 
 
 THREE.extend( THREE.Vector2.prototype, {
 THREE.extend( THREE.Vector2.prototype, {
 
 
-	constructor: THREE.Vector2,
-
 	set: function ( x, y ) {
 	set: function ( x, y ) {
 
 
 		this.x = x;
 		this.x = x;
@@ -301,4 +299,4 @@ THREE.extend( THREE.Vector2.prototype, {
 
 
 	}
 	}
 
 
-} );
+} );

+ 3 - 5
src/math/Vector3.js

@@ -17,8 +17,6 @@ THREE.Vector3 = function ( x, y, z ) {
 
 
 THREE.extend( THREE.Vector3.prototype, {
 THREE.extend( THREE.Vector3.prototype, {
 
 
-	constructor: THREE.Vector3,
-
 	set: function ( x, y, z ) {
 	set: function ( x, y, z ) {
 
 
 		this.x = x;
 		this.x = x;
@@ -270,7 +268,7 @@ THREE.extend( THREE.Vector3.prototype, {
 	applyEuler: function() {
 	applyEuler: function() {
 
 
 		var q1 = new THREE.Quaternion();
 		var q1 = new THREE.Quaternion();
-		
+
 		return function ( v, eulerOrder ) {
 		return function ( v, eulerOrder ) {
 
 
 			var quaternion = q1.setFromEuler( v, eulerOrder );
 			var quaternion = q1.setFromEuler( v, eulerOrder );
@@ -286,7 +284,7 @@ THREE.extend( THREE.Vector3.prototype, {
 	applyAxisAngle: function() {
 	applyAxisAngle: function() {
 
 
 		var q1 = new THREE.Quaternion();
 		var q1 = new THREE.Quaternion();
-		
+
 		return function ( axis, angle ) {
 		return function ( axis, angle ) {
 
 
 			var quaternion = q1.setFromAxisAngle( axis, angle );
 			var quaternion = q1.setFromAxisAngle( axis, angle );
@@ -740,4 +738,4 @@ THREE.extend( THREE.Vector3.prototype, {
 
 
 	}
 	}
 
 
-} );
+} );

+ 1 - 3
src/math/Vector4.js

@@ -17,8 +17,6 @@ THREE.Vector4 = function ( x, y, z, w ) {
 
 
 THREE.extend( THREE.Vector4.prototype, {
 THREE.extend( THREE.Vector4.prototype, {
 
 
-	constructor: THREE.Vector4,
-
 	set: function ( x, y, z, w ) {
 	set: function ( x, y, z, w ) {
 
 
 		this.x = x;
 		this.x = x;
@@ -553,4 +551,4 @@ THREE.extend( THREE.Vector4.prototype, {
 
 
 	}
 	}
 
 
-} );
+} );