Mr.doob 6 年之前
父節點
當前提交
e622cc7890
共有 6 個文件被更改,包括 372 次插入396 次删除
  1. 69 71
      build/three.js
  2. 231 251
      build/three.min.js
  3. 69 71
      build/three.module.js
  4. 1 1
      editor/sw.js
  5. 1 1
      package.json
  6. 1 1
      src/constants.js

+ 69 - 71
build/three.js

@@ -185,7 +185,7 @@
 
 	} );
 
-	var REVISION = '107dev';
+	var REVISION = '107';
 	var MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
 	var TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
 	var CullFaceNone = 0;
@@ -2349,6 +2349,8 @@
 	 * @author tschw
 	 */
 
+	var _vector;
+
 	function Matrix3() {
 
 		this.elements = [
@@ -2432,29 +2434,25 @@
 
 		},
 
-		applyToBufferAttribute: function () {
-
-			var v1 = new Vector3();
-
-			return function applyToBufferAttribute( attribute ) {
+		applyToBufferAttribute: function ( attribute ) {
 
-				for ( var i = 0, l = attribute.count; i < l; i ++ ) {
+			if ( _vector === undefined ) _vector = new Vector3();
 
-					v1.x = attribute.getX( i );
-					v1.y = attribute.getY( i );
-					v1.z = attribute.getZ( i );
+			for ( var i = 0, l = attribute.count; i < l; i ++ ) {
 
-					v1.applyMatrix3( this );
+				_vector.x = attribute.getX( i );
+				_vector.y = attribute.getY( i );
+				_vector.z = attribute.getZ( i );
 
-					attribute.setXYZ( i, v1.x, v1.y, v1.z );
+				_vector.applyMatrix3( this );
 
-				}
+				attribute.setXYZ( i, _vector.x, _vector.y, _vector.z );
 
-				return attribute;
+			}
 
-			};
+			return attribute;
 
-		}(),
+		},
 
 		multiply: function ( m ) {
 
@@ -4825,6 +4823,8 @@
 	 * @author bhouston / http://clara.io
 	 */
 
+	var _matrix, _quaternion;
+
 	function Euler( x, y, z, order ) {
 
 		this._x = x || 0;
@@ -5069,19 +5069,15 @@
 
 		},
 
-		setFromQuaternion: function () {
+		setFromQuaternion: function ( q, order, update ) {
 
-			var matrix = new Matrix4();
-
-			return function setFromQuaternion( q, order, update ) {
+			if ( _matrix === undefined ) _matrix = new Matrix4();
 
-				matrix.makeRotationFromQuaternion( q );
+			_matrix.makeRotationFromQuaternion( q );
 
-				return this.setFromRotationMatrix( matrix, order, update );
-
-			};
+			return this.setFromRotationMatrix( _matrix, order, update );
 
-		}(),
+		},
 
 		setFromVector3: function ( v, order ) {
 
@@ -5089,21 +5085,17 @@
 
 		},
 
-		reorder: function () {
+		reorder: function ( newOrder ) {
 
 			// WARNING: this discards revolution information -bhouston
 
-			var q = new Quaternion();
+			if ( _quaternion === undefined ) _quaternion = new Quaternion();
 
-			return function reorder( newOrder ) {
+			_quaternion.setFromEuler( this );
 
-				q.setFromEuler( this );
+			return this.setFromQuaternion( _quaternion, newOrder );
 
-				return this.setFromQuaternion( q, newOrder );
-
-			};
-
-		}(),
+		},
 
 		equals: function ( euler ) {
 
@@ -6807,6 +6799,8 @@
 	 * @author mrdoob / http://mrdoob.com/
 	 */
 
+	var _box;
+
 	function Sphere( center, radius ) {
 
 		this.center = ( center !== undefined ) ? center : new Vector3();
@@ -6825,39 +6819,35 @@
 
 		},
 
-		setFromPoints: function () {
-
-			var box = new Box3();
-
-			return function setFromPoints( points, optionalCenter ) {
+		setFromPoints: function ( points, optionalCenter ) {
 
-				var center = this.center;
+			if ( _box === undefined ) _box = new Box3();
 
-				if ( optionalCenter !== undefined ) {
+			var center = this.center;
 
-					center.copy( optionalCenter );
+			if ( optionalCenter !== undefined ) {
 
-				} else {
+				center.copy( optionalCenter );
 
-					box.setFromPoints( points ).getCenter( center );
+			} else {
 
-				}
+				_box.setFromPoints( points ).getCenter( center );
 
-				var maxRadiusSq = 0;
+			}
 
-				for ( var i = 0, il = points.length; i < il; i ++ ) {
+			var maxRadiusSq = 0;
 
-					maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( points[ i ] ) );
+			for ( var i = 0, il = points.length; i < il; i ++ ) {
 
-				}
+				maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( points[ i ] ) );
 
-				this.radius = Math.sqrt( maxRadiusSq );
+			}
 
-				return this;
+			this.radius = Math.sqrt( maxRadiusSq );
 
-			};
+			return this;
 
-		}(),
+		},
 
 		clone: function () {
 
@@ -27847,7 +27837,7 @@
 
 		// all vertices should lie on a conceptual sphere with a given radius
 
-		appplyRadius( radius );
+		applyRadius( radius );
 
 		// finally, create the uv data
 
@@ -27960,7 +27950,7 @@
 
 		}
 
-		function appplyRadius( radius ) {
+		function applyRadius( radius ) {
 
 			var vertex = new Vector3();
 
@@ -40138,7 +40128,13 @@
 
 		var glyph = data.glyphs[ char ] || data.glyphs[ '?' ];
 
-		if ( ! glyph ) return;
+		if ( ! glyph ) {
+
+			console.error( 'THREE.Font: character "' + char + '" does not exists in font family ' + data.familyName + '.' );
+
+			return;
+
+		}
 
 		var path = new ShapePath();
 
@@ -45158,6 +45154,8 @@
 	 * @author bhouston / http://clara.io
 	 */
 
+	var _startP, _startEnd;
+
 	function Line3( start, end ) {
 
 		this.start = ( start !== undefined ) ? start : new Vector3();
@@ -45242,32 +45240,32 @@
 
 		},
 
-		closestPointToPointParameter: function () {
+		closestPointToPointParameter: function ( point, clampToLine ) {
 
-			var startP = new Vector3();
-			var startEnd = new Vector3();
+			if ( _startP === undefined ) {
 
-			return function closestPointToPointParameter( point, clampToLine ) {
+				_startP = new Vector3();
+				_startEnd = new Vector3();
 
-				startP.subVectors( point, this.start );
-				startEnd.subVectors( this.end, this.start );
+			}
 
-				var startEnd2 = startEnd.dot( startEnd );
-				var startEnd_startP = startEnd.dot( startP );
+			_startP.subVectors( point, this.start );
+			_startEnd.subVectors( this.end, this.start );
 
-				var t = startEnd_startP / startEnd2;
+			var startEnd2 = _startEnd.dot( _startEnd );
+			var startEnd_startP = _startEnd.dot( _startP );
 
-				if ( clampToLine ) {
+			var t = startEnd_startP / startEnd2;
 
-					t = _Math.clamp( t, 0, 1 );
+			if ( clampToLine ) {
 
-				}
+				t = _Math.clamp( t, 0, 1 );
 
-				return t;
+			}
 
-			};
+			return t;
 
-		}(),
+		},
 
 		closestPointToPoint: function ( point, clampToLine, target ) {
 

文件差異過大導致無法顯示
+ 231 - 251
build/three.min.js


+ 69 - 71
build/three.module.js

@@ -179,7 +179,7 @@ Object.assign( EventDispatcher.prototype, {
 
 } );
 
-var REVISION = '107dev';
+var REVISION = '107';
 var MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
 var TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
 var CullFaceNone = 0;
@@ -2343,6 +2343,8 @@ Object.assign( Vector3.prototype, {
  * @author tschw
  */
 
+var _vector;
+
 function Matrix3() {
 
 	this.elements = [
@@ -2426,29 +2428,25 @@ Object.assign( Matrix3.prototype, {
 
 	},
 
-	applyToBufferAttribute: function () {
-
-		var v1 = new Vector3();
-
-		return function applyToBufferAttribute( attribute ) {
+	applyToBufferAttribute: function ( attribute ) {
 
-			for ( var i = 0, l = attribute.count; i < l; i ++ ) {
+		if ( _vector === undefined ) _vector = new Vector3();
 
-				v1.x = attribute.getX( i );
-				v1.y = attribute.getY( i );
-				v1.z = attribute.getZ( i );
+		for ( var i = 0, l = attribute.count; i < l; i ++ ) {
 
-				v1.applyMatrix3( this );
+			_vector.x = attribute.getX( i );
+			_vector.y = attribute.getY( i );
+			_vector.z = attribute.getZ( i );
 
-				attribute.setXYZ( i, v1.x, v1.y, v1.z );
+			_vector.applyMatrix3( this );
 
-			}
+			attribute.setXYZ( i, _vector.x, _vector.y, _vector.z );
 
-			return attribute;
+		}
 
-		};
+		return attribute;
 
-	}(),
+	},
 
 	multiply: function ( m ) {
 
@@ -4819,6 +4817,8 @@ Object.assign( Matrix4.prototype, {
  * @author bhouston / http://clara.io
  */
 
+var _matrix, _quaternion;
+
 function Euler( x, y, z, order ) {
 
 	this._x = x || 0;
@@ -5063,19 +5063,15 @@ Object.assign( Euler.prototype, {
 
 	},
 
-	setFromQuaternion: function () {
+	setFromQuaternion: function ( q, order, update ) {
 
-		var matrix = new Matrix4();
-
-		return function setFromQuaternion( q, order, update ) {
+		if ( _matrix === undefined ) _matrix = new Matrix4();
 
-			matrix.makeRotationFromQuaternion( q );
+		_matrix.makeRotationFromQuaternion( q );
 
-			return this.setFromRotationMatrix( matrix, order, update );
-
-		};
+		return this.setFromRotationMatrix( _matrix, order, update );
 
-	}(),
+	},
 
 	setFromVector3: function ( v, order ) {
 
@@ -5083,21 +5079,17 @@ Object.assign( Euler.prototype, {
 
 	},
 
-	reorder: function () {
+	reorder: function ( newOrder ) {
 
 		// WARNING: this discards revolution information -bhouston
 
-		var q = new Quaternion();
+		if ( _quaternion === undefined ) _quaternion = new Quaternion();
 
-		return function reorder( newOrder ) {
+		_quaternion.setFromEuler( this );
 
-			q.setFromEuler( this );
+		return this.setFromQuaternion( _quaternion, newOrder );
 
-			return this.setFromQuaternion( q, newOrder );
-
-		};
-
-	}(),
+	},
 
 	equals: function ( euler ) {
 
@@ -6801,6 +6793,8 @@ Object.assign( Box3.prototype, {
  * @author mrdoob / http://mrdoob.com/
  */
 
+var _box;
+
 function Sphere( center, radius ) {
 
 	this.center = ( center !== undefined ) ? center : new Vector3();
@@ -6819,39 +6813,35 @@ Object.assign( Sphere.prototype, {
 
 	},
 
-	setFromPoints: function () {
-
-		var box = new Box3();
-
-		return function setFromPoints( points, optionalCenter ) {
+	setFromPoints: function ( points, optionalCenter ) {
 
-			var center = this.center;
+		if ( _box === undefined ) _box = new Box3();
 
-			if ( optionalCenter !== undefined ) {
+		var center = this.center;
 
-				center.copy( optionalCenter );
+		if ( optionalCenter !== undefined ) {
 
-			} else {
+			center.copy( optionalCenter );
 
-				box.setFromPoints( points ).getCenter( center );
+		} else {
 
-			}
+			_box.setFromPoints( points ).getCenter( center );
 
-			var maxRadiusSq = 0;
+		}
 
-			for ( var i = 0, il = points.length; i < il; i ++ ) {
+		var maxRadiusSq = 0;
 
-				maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( points[ i ] ) );
+		for ( var i = 0, il = points.length; i < il; i ++ ) {
 
-			}
+			maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( points[ i ] ) );
 
-			this.radius = Math.sqrt( maxRadiusSq );
+		}
 
-			return this;
+		this.radius = Math.sqrt( maxRadiusSq );
 
-		};
+		return this;
 
-	}(),
+	},
 
 	clone: function () {
 
@@ -27841,7 +27831,7 @@ function PolyhedronBufferGeometry( vertices, indices, radius, detail ) {
 
 	// all vertices should lie on a conceptual sphere with a given radius
 
-	appplyRadius( radius );
+	applyRadius( radius );
 
 	// finally, create the uv data
 
@@ -27954,7 +27944,7 @@ function PolyhedronBufferGeometry( vertices, indices, radius, detail ) {
 
 	}
 
-	function appplyRadius( radius ) {
+	function applyRadius( radius ) {
 
 		var vertex = new Vector3();
 
@@ -40132,7 +40122,13 @@ function createPath( char, scale, offsetX, offsetY, data ) {
 
 	var glyph = data.glyphs[ char ] || data.glyphs[ '?' ];
 
-	if ( ! glyph ) return;
+	if ( ! glyph ) {
+
+		console.error( 'THREE.Font: character "' + char + '" does not exists in font family ' + data.familyName + '.' );
+
+		return;
+
+	}
 
 	var path = new ShapePath();
 
@@ -45152,6 +45148,8 @@ Object.assign( Box2.prototype, {
  * @author bhouston / http://clara.io
  */
 
+var _startP, _startEnd;
+
 function Line3( start, end ) {
 
 	this.start = ( start !== undefined ) ? start : new Vector3();
@@ -45236,32 +45234,32 @@ Object.assign( Line3.prototype, {
 
 	},
 
-	closestPointToPointParameter: function () {
+	closestPointToPointParameter: function ( point, clampToLine ) {
 
-		var startP = new Vector3();
-		var startEnd = new Vector3();
+		if ( _startP === undefined ) {
 
-		return function closestPointToPointParameter( point, clampToLine ) {
+			_startP = new Vector3();
+			_startEnd = new Vector3();
 
-			startP.subVectors( point, this.start );
-			startEnd.subVectors( this.end, this.start );
+		}
 
-			var startEnd2 = startEnd.dot( startEnd );
-			var startEnd_startP = startEnd.dot( startP );
+		_startP.subVectors( point, this.start );
+		_startEnd.subVectors( this.end, this.start );
 
-			var t = startEnd_startP / startEnd2;
+		var startEnd2 = _startEnd.dot( _startEnd );
+		var startEnd_startP = _startEnd.dot( _startP );
 
-			if ( clampToLine ) {
+		var t = startEnd_startP / startEnd2;
 
-				t = _Math.clamp( t, 0, 1 );
+		if ( clampToLine ) {
 
-			}
+			t = _Math.clamp( t, 0, 1 );
 
-			return t;
+		}
 
-		};
+		return t;
 
-	}(),
+	},
 
 	closestPointToPoint: function ( point, clampToLine, target ) {
 

+ 1 - 1
editor/sw.js

@@ -1,4 +1,4 @@
-// r106
+// r107
 
 const staticAssets = [
 	'./',

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "three",
-  "version": "0.106.2",
+  "version": "0.107.0",
   "description": "JavaScript 3D library",
   "main": "build/three.js",
   "repository": "mrdoob/three.js",

+ 1 - 1
src/constants.js

@@ -1,4 +1,4 @@
-export var REVISION = '107dev';
+export var REVISION = '107';
 export var MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
 export var TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
 export var CullFaceNone = 0;

部分文件因文件數量過多而無法顯示