瀏覽代碼

Merge branch 'dev' into manual/Movepage/runningLocally

Mr.doob 8 年之前
父節點
當前提交
6b08084037

+ 1 - 1
README.md

@@ -13,7 +13,7 @@ The aim of the project is to create an easy to use, lightweight, 3D library. The
 [Examples](http://threejs.org/examples/) —
 [Examples](http://threejs.org/examples/) —
 [Documentation](http://threejs.org/docs/) —
 [Documentation](http://threejs.org/docs/) —
 [Wiki](https://github.com/mrdoob/three.js/wiki) —
 [Wiki](https://github.com/mrdoob/three.js/wiki) —
-[Migrating](https://github.com/mrdoob/three.js/wiki/Migration) —
+[Migrating](https://github.com/mrdoob/three.js/wiki/Migration-Guide) —
 [Help](http://stackoverflow.com/questions/tagged/three.js)
 [Help](http://stackoverflow.com/questions/tagged/three.js)
 
 
 ### Usage ###
 ### Usage ###

+ 172 - 331
build/three.js

@@ -928,11 +928,11 @@
 
 
 		},
 		},
 
 
-		fromAttribute: function ( attribute, index, offset ) {
+		fromBufferAttribute: function ( attribute, index, offset ) {
 
 
 			if ( offset !== undefined ) {
 			if ( offset !== undefined ) {
 
 
-				console.warn( 'THREE.Vector2: offset has been removed from .fromAttribute().' );
+				console.warn( 'THREE.Vector2: offset has been removed from .fromBufferAttribute().' );
 
 
 			}
 			}
 
 
@@ -1855,11 +1855,11 @@
 
 
 		},
 		},
 
 
-		fromAttribute: function ( attribute, index, offset ) {
+		fromBufferAttribute: function ( attribute, index, offset ) {
 
 
 			if ( offset !== undefined ) {
 			if ( offset !== undefined ) {
 
 
-				console.warn( 'THREE.Vector4: offset has been removed from .fromAttribute().' );
+				console.warn( 'THREE.Vector4: offset has been removed from .fromBufferAttribute().' );
 
 
 			}
 			}
 
 
@@ -2859,32 +2859,15 @@
 
 
 		applyMatrix4: function ( m ) {
 		applyMatrix4: function ( m ) {
 
 
-			// input: THREE.Matrix4 affine matrix
-
 			var x = this.x, y = this.y, z = this.z;
 			var x = this.x, y = this.y, z = this.z;
 			var e = m.elements;
 			var e = m.elements;
 
 
 			this.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ]  * z + e[ 12 ];
 			this.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ]  * z + e[ 12 ];
 			this.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ]  * z + e[ 13 ];
 			this.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ]  * z + e[ 13 ];
 			this.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ];
 			this.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ];
+			var w =  e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ];
 
 
-			return this;
-
-		},
-
-		applyProjection: function ( m ) {
-
-			// input: THREE.Matrix4 projection matrix
-
-			var x = this.x, y = this.y, z = this.z;
-			var e = m.elements;
-			var d = 1 / ( e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ] ); // perspective divide
-
-			this.x = ( e[ 0 ] * x + e[ 4 ] * y + e[ 8 ]  * z + e[ 12 ] ) * d;
-			this.y = ( e[ 1 ] * x + e[ 5 ] * y + e[ 9 ]  * z + e[ 13 ] ) * d;
-			this.z = ( e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] ) * d;
-
-			return this;
+			return this.divideScalar( w );
 
 
 		},
 		},
 
 
@@ -2919,7 +2902,7 @@
 				if ( matrix === undefined ) matrix = new Matrix4();
 				if ( matrix === undefined ) matrix = new Matrix4();
 
 
 				matrix.multiplyMatrices( camera.projectionMatrix, matrix.getInverse( camera.matrixWorld ) );
 				matrix.multiplyMatrices( camera.projectionMatrix, matrix.getInverse( camera.matrixWorld ) );
-				return this.applyProjection( matrix );
+				return this.applyMatrix4( matrix );
 
 
 			};
 			};
 
 
@@ -2934,7 +2917,7 @@
 				if ( matrix === undefined ) matrix = new Matrix4();
 				if ( matrix === undefined ) matrix = new Matrix4();
 
 
 				matrix.multiplyMatrices( camera.matrixWorld, matrix.getInverse( camera.projectionMatrix ) );
 				matrix.multiplyMatrices( camera.matrixWorld, matrix.getInverse( camera.projectionMatrix ) );
-				return this.applyProjection( matrix );
+				return this.applyMatrix4( matrix );
 
 
 			};
 			};
 
 
@@ -3327,11 +3310,11 @@
 
 
 		},
 		},
 
 
-		fromAttribute: function ( attribute, index, offset ) {
+		fromBufferAttribute: function ( attribute, index, offset ) {
 
 
 			if ( offset !== undefined ) {
 			if ( offset !== undefined ) {
 
 
-				console.warn( 'THREE.Vector3: offset has been removed from .fromAttribute().' );
+				console.warn( 'THREE.Vector3: offset has been removed from .fromBufferAttribute().' );
 
 
 			}
 			}
 
 
@@ -6633,7 +6616,7 @@
 				tempPosition.set( flare.matrixWorld.elements[ 12 ], flare.matrixWorld.elements[ 13 ], flare.matrixWorld.elements[ 14 ] );
 				tempPosition.set( flare.matrixWorld.elements[ 12 ], flare.matrixWorld.elements[ 13 ], flare.matrixWorld.elements[ 14 ] );
 
 
 				tempPosition.applyMatrix4( camera.matrixWorldInverse );
 				tempPosition.applyMatrix4( camera.matrixWorldInverse );
-				tempPosition.applyProjection( camera.projectionMatrix );
+				tempPosition.applyMatrix4( camera.projectionMatrix );
 
 
 				// setup arrays for gl programs
 				// setup arrays for gl programs
 
 
@@ -7865,7 +7848,7 @@
 
 
 								for ( i = 0, l = attribute.count; i < l; i ++ ) {
 								for ( i = 0, l = attribute.count; i < l; i ++ ) {
 
 
-									v1.fromAttribute( attribute, i ).applyMatrix4( node.matrixWorld );
+									v1.fromBufferAttribute( attribute, i ).applyMatrix4( node.matrixWorld );
 
 
 									scope.expandByPoint( v1 );
 									scope.expandByPoint( v1 );
 
 
@@ -14817,23 +14800,23 @@
 
 
 			}
 			}
 
 
-			function checkBufferGeometryIntersection( object, raycaster, ray, positions, uvs, a, b, c ) {
+			function checkBufferGeometryIntersection( object, raycaster, ray, position, uv, a, b, c ) {
 
 
-				vA.fromArray( positions, a * 3 );
-				vB.fromArray( positions, b * 3 );
-				vC.fromArray( positions, c * 3 );
+				vA.fromBufferAttribute( position, a );
+				vB.fromBufferAttribute( position, b );
+				vC.fromBufferAttribute( position, c );
 
 
 				var intersection = checkIntersection( object, raycaster, ray, vA, vB, vC, intersectionPoint );
 				var intersection = checkIntersection( object, raycaster, ray, vA, vB, vC, intersectionPoint );
 
 
 				if ( intersection ) {
 				if ( intersection ) {
 
 
-					if ( uvs ) {
+					if ( uv ) {
 
 
-						uvA.fromArray( uvs, a * 2 );
-						uvB.fromArray( uvs, b * 2 );
-						uvC.fromArray( uvs, c * 2 );
+						uvA.fromBufferAttribute( uv, a );
+						uvB.fromBufferAttribute( uv, b );
+						uvC.fromBufferAttribute( uv, c );
 
 
-						intersection.uv = uvIntersection( intersectionPoint,  vA, vB, vC,  uvA, uvB, uvC );
+						intersection.uv = uvIntersection( intersectionPoint,  vA, vB, vC, uvA, uvB, uvC );
 
 
 					}
 					}
 
 
@@ -14876,32 +14859,27 @@
 
 
 				}
 				}
 
 
-				var uvs, intersection;
+				var intersection;
 
 
 				if ( geometry.isBufferGeometry ) {
 				if ( geometry.isBufferGeometry ) {
 
 
 					var a, b, c;
 					var a, b, c;
 					var index = geometry.index;
 					var index = geometry.index;
-					var attributes = geometry.attributes;
-					var positions = attributes.position.array;
-
-					if ( attributes.uv !== undefined ) {
-
-						uvs = attributes.uv.array;
-
-					}
+					var position = geometry.attributes.position;
+					var uv = geometry.attributes.uv;
+					var i, l;
 
 
 					if ( index !== null ) {
 					if ( index !== null ) {
 
 
-						var indices = index.array;
+						// indexed buffer geometry
 
 
-						for ( var i = 0, l = indices.length; i < l; i += 3 ) {
+						for ( i = 0, l = index.count; i < l; i += 3 ) {
 
 
-							a = indices[ i ];
-							b = indices[ i + 1 ];
-							c = indices[ i + 2 ];
+							a = index.getX( i );
+							b = index.getX( i + 1 );
+							c = index.getX( i + 2 );
 
 
-							intersection = checkBufferGeometryIntersection( this, raycaster, ray, positions, uvs, a, b, c );
+							intersection = checkBufferGeometryIntersection( this, raycaster, ray, position, uv, a, b, c );
 
 
 							if ( intersection ) {
 							if ( intersection ) {
 
 
@@ -14914,14 +14892,15 @@
 
 
 					} else {
 					} else {
 
 
+						// non-indexed buffer geometry
 
 
-						for ( var i = 0, l = positions.length; i < l; i += 9 ) {
+						for ( i = 0, l = position.count; i < l; i += 3 ) {
 
 
-							a = i / 3;
-							b = a + 1;
-							c = a + 2;
+							a = i;
+							b = i + 1;
+							c = i + 2;
 
 
-							intersection = checkBufferGeometryIntersection( this, raycaster, ray, positions, uvs, a, b, c );
+							intersection = checkBufferGeometryIntersection( this, raycaster, ray, position, uv, a, b, c );
 
 
 							if ( intersection ) {
 							if ( intersection ) {
 
 
@@ -14937,11 +14916,13 @@
 				} else if ( geometry.isGeometry ) {
 				} else if ( geometry.isGeometry ) {
 
 
 					var fvA, fvB, fvC;
 					var fvA, fvB, fvC;
-					var isFaceMaterial = (material && material.isMultiMaterial);
+					var isFaceMaterial = ( material && material.isMultiMaterial );
 					var materials = isFaceMaterial === true ? material.materials : null;
 					var materials = isFaceMaterial === true ? material.materials : null;
 
 
 					var vertices = geometry.vertices;
 					var vertices = geometry.vertices;
 					var faces = geometry.faces;
 					var faces = geometry.faces;
+					var uvs;
+
 					var faceVertexUvs = geometry.faceVertexUvs[ 0 ];
 					var faceVertexUvs = geometry.faceVertexUvs[ 0 ];
 					if ( faceVertexUvs.length > 0 ) uvs = faceVertexUvs;
 					if ( faceVertexUvs.length > 0 ) uvs = faceVertexUvs;
 
 
@@ -20856,7 +20837,7 @@
 					if ( _this.sortObjects === true ) {
 					if ( _this.sortObjects === true ) {
 
 
 						_vector3.setFromMatrixPosition( object.matrixWorld );
 						_vector3.setFromMatrixPosition( object.matrixWorld );
-						_vector3.applyProjection( _projScreenMatrix );
+						_vector3.applyMatrix4( _projScreenMatrix );
 
 
 					}
 					}
 
 
@@ -20879,7 +20860,7 @@
 							if ( _this.sortObjects === true ) {
 							if ( _this.sortObjects === true ) {
 
 
 								_vector3.setFromMatrixPosition( object.matrixWorld );
 								_vector3.setFromMatrixPosition( object.matrixWorld );
-								_vector3.applyProjection( _projScreenMatrix );
+								_vector3.applyMatrix4( _projScreenMatrix );
 
 
 							}
 							}
 
 
@@ -29364,8 +29345,7 @@
 	 * Abstract Base class to load generic binary textures formats (rgbe, hdr, ...)
 	 * Abstract Base class to load generic binary textures formats (rgbe, hdr, ...)
 	 */
 	 */
 
 
-	var DataTextureLoader = BinaryTextureLoader;
-	function BinaryTextureLoader( manager ) {
+	function DataTextureLoader( manager ) {
 
 
 		this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager;
 		this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager;
 
 
@@ -29374,7 +29354,7 @@
 
 
 	}
 	}
 
 
-	Object.assign( BinaryTextureLoader.prototype, {
+	Object.assign( DataTextureLoader.prototype, {
 
 
 		load: function ( url, onLoad, onProgress, onError ) {
 		load: function ( url, onLoad, onProgress, onError ) {
 
 
@@ -29461,56 +29441,64 @@
 
 
 		load: function ( url, onLoad, onProgress, onError ) {
 		load: function ( url, onLoad, onProgress, onError ) {
 
 
+			if ( url === undefined ) url = '';
+
+			if ( this.path !== undefined ) url = this.path + url;
+
 			var scope = this;
 			var scope = this;
 
 
-			var image = document.createElementNS( 'http://www.w3.org/1999/xhtml', 'img' );
-			image.onload = function () {
+			var cached = Cache.get( url );
 
 
-				image.onload = null;
+			if ( cached !== undefined ) {
 
 
-				URL.revokeObjectURL( image.src );
+				scope.manager.itemStart( url );
 
 
-				if ( onLoad ) onLoad( image );
+				setTimeout( function () {
 
 
-				scope.manager.itemEnd( url );
+					if ( onLoad ) onLoad( cached );
 
 
-			};
-			image.onerror = onError;
+					scope.manager.itemEnd( url );
 
 
-			if ( url.indexOf( 'data:' ) === 0 ) {
+				}, 0 );
 
 
-				image.src = url;
+				return cached;
 
 
-			} else if ( this.crossOrigin !== undefined ) {
+			}
 
 
-				// crossOrigin doesn't work with URL.createObjectURL()?
+			var image = document.createElementNS( 'http://www.w3.org/1999/xhtml', 'img' );
 
 
-				image.crossOrigin = this.crossOrigin;
-				image.src = url;
+			image.addEventListener( 'load', function () {
 
 
-			} else {
+				THREE.Cache.add( url, this );
 
 
-				var loader = new FileLoader();
-				loader.setPath( this.path );
-				loader.setResponseType( 'blob' );
-				loader.setWithCredentials( this.withCredentials );
+				if ( onLoad ) onLoad( this );
 
 
-				// By default the FileLoader requests files to be loaded with a MIME
-				// type of `text/plain`. Using `URL.createObjectURL()` with SVGs that
-				// have a MIME type of `text/plain` results in an error, so explicitly
-				// set the SVG MIME type.
-				if ( /\.svg$/.test( url ) ) loader.setMimeType( 'image/svg+xml' );
+				scope.manager.itemEnd( url );
 
 
-				loader.load( url, function ( blob ) {
+			}, false );
 
 
-					image.src = URL.createObjectURL( blob );
+			/*
+			image.addEventListener( 'progress', function ( event ) {
 
 
-				}, onProgress, onError );
+				if ( onProgress ) onProgress( event );
 
 
-			}
+			}, false );
+			*/
+
+			image.addEventListener( 'error', function ( event ) {
+
+				if ( onError ) onError( event );
+
+				scope.manager.itemError( url );
+
+			}, false );
+
+			if ( this.crossOrigin !== undefined ) image.crossOrigin = this.crossOrigin;
 
 
 			scope.manager.itemStart( url );
 			scope.manager.itemStart( url );
 
 
+			image.src = url;
+
 			return image;
 			return image;
 
 
 		},
 		},
@@ -29522,13 +29510,6 @@
 
 
 		},
 		},
 
 
-		setWithCredentials: function ( value ) {
-
-			this.withCredentials = value;
-			return this;
-
-		},
-
 		setPath: function ( value ) {
 		setPath: function ( value ) {
 
 
 			this.path = value;
 			this.path = value;
@@ -29624,7 +29605,6 @@
 
 
 			var loader = new ImageLoader( this.manager );
 			var loader = new ImageLoader( this.manager );
 			loader.setCrossOrigin( this.crossOrigin );
 			loader.setCrossOrigin( this.crossOrigin );
-			loader.setWithCredentials( this.withCredentials );
 			loader.setPath( this.path );
 			loader.setPath( this.path );
 			loader.load( url, function ( image ) {
 			loader.load( url, function ( image ) {
 
 
@@ -29654,13 +29634,6 @@
 
 
 		},
 		},
 
 
-		setWithCredentials: function ( value ) {
-
-			this.withCredentials = value;
-			return this;
-
-		},
-
 		setPath: function ( value ) {
 		setPath: function ( value ) {
 
 
 			this.path = value;
 			this.path = value;
@@ -29668,8 +29641,6 @@
 
 
 		}
 		}
 
 
-
-
 	} );
 	} );
 
 
 	/**
 	/**
@@ -33679,7 +33650,7 @@
 	 * THREE.LineCurve3
 	 * THREE.LineCurve3
 	 * THREE.QuadraticBezierCurve3
 	 * THREE.QuadraticBezierCurve3
 	 * THREE.CubicBezierCurve3
 	 * THREE.CubicBezierCurve3
-	 * THREE.SplineCurve3
+	 * THREE.CatmullRomCurve3
 	 *
 	 *
 	 * A series of curves can be represented as a THREE.CurvePath
 	 * A series of curves can be represented as a THREE.CurvePath
 	 *
 	 *
@@ -39289,183 +39260,6 @@
 
 
 	};
 	};
 
 
-	/**
-	 * Spline from Tween.js, slightly optimized (and trashed)
-	 * http://sole.github.com/tween.js/examples/05_spline.html
-	 *
-	 * @author mrdoob / http://mrdoob.com/
-	 * @author alteredq / http://alteredqualia.com/
-	 */
-
-	function Spline( points ) {
-
-		this.points = points;
-
-		var c = [], v3 = { x: 0, y: 0, z: 0 },
-		point, intPoint, weight, w2, w3,
-		pa, pb, pc, pd;
-
-		this.initFromArray = function ( a ) {
-
-			this.points = [];
-
-			for ( var i = 0; i < a.length; i ++ ) {
-
-				this.points[ i ] = { x: a[ i ][ 0 ], y: a[ i ][ 1 ], z: a[ i ][ 2 ] };
-
-			}
-
-		};
-
-		this.getPoint = function ( k ) {
-
-			point = ( this.points.length - 1 ) * k;
-			intPoint = Math.floor( point );
-			weight = point - intPoint;
-
-			c[ 0 ] = intPoint === 0 ? intPoint : intPoint - 1;
-			c[ 1 ] = intPoint;
-			c[ 2 ] = intPoint  > this.points.length - 2 ? this.points.length - 1 : intPoint + 1;
-			c[ 3 ] = intPoint  > this.points.length - 3 ? this.points.length - 1 : intPoint + 2;
-
-			pa = this.points[ c[ 0 ] ];
-			pb = this.points[ c[ 1 ] ];
-			pc = this.points[ c[ 2 ] ];
-			pd = this.points[ c[ 3 ] ];
-
-			w2 = weight * weight;
-			w3 = weight * w2;
-
-			v3.x = interpolate( pa.x, pb.x, pc.x, pd.x, weight, w2, w3 );
-			v3.y = interpolate( pa.y, pb.y, pc.y, pd.y, weight, w2, w3 );
-			v3.z = interpolate( pa.z, pb.z, pc.z, pd.z, weight, w2, w3 );
-
-			return v3;
-
-		};
-
-		this.getControlPointsArray = function () {
-
-			var i, p, l = this.points.length,
-				coords = [];
-
-			for ( i = 0; i < l; i ++ ) {
-
-				p = this.points[ i ];
-				coords[ i ] = [ p.x, p.y, p.z ];
-
-			}
-
-			return coords;
-
-		};
-
-		// approximate length by summing linear segments
-
-		this.getLength = function ( nSubDivisions ) {
-
-			var i, index, nSamples, position,
-				point = 0, intPoint = 0, oldIntPoint = 0,
-				oldPosition = new Vector3(),
-				tmpVec = new Vector3(),
-				chunkLengths = [],
-				totalLength = 0;
-
-			// first point has 0 length
-
-			chunkLengths[ 0 ] = 0;
-
-			if ( ! nSubDivisions ) nSubDivisions = 100;
-
-			nSamples = this.points.length * nSubDivisions;
-
-			oldPosition.copy( this.points[ 0 ] );
-
-			for ( i = 1; i < nSamples; i ++ ) {
-
-				index = i / nSamples;
-
-				position = this.getPoint( index );
-				tmpVec.copy( position );
-
-				totalLength += tmpVec.distanceTo( oldPosition );
-
-				oldPosition.copy( position );
-
-				point = ( this.points.length - 1 ) * index;
-				intPoint = Math.floor( point );
-
-				if ( intPoint !== oldIntPoint ) {
-
-					chunkLengths[ intPoint ] = totalLength;
-					oldIntPoint = intPoint;
-
-				}
-
-			}
-
-			// last point ends with total length
-
-			chunkLengths[ chunkLengths.length ] = totalLength;
-
-			return { chunks: chunkLengths, total: totalLength };
-
-		};
-
-		this.reparametrizeByArcLength = function ( samplingCoef ) {
-
-			var i, j,
-				index, indexCurrent, indexNext,
-				realDistance,
-				sampling, position,
-				newpoints = [],
-				tmpVec = new Vector3(),
-				sl = this.getLength();
-
-			newpoints.push( tmpVec.copy( this.points[ 0 ] ).clone() );
-
-			for ( i = 1; i < this.points.length; i ++ ) {
-
-				//tmpVec.copy( this.points[ i - 1 ] );
-				//linearDistance = tmpVec.distanceTo( this.points[ i ] );
-
-				realDistance = sl.chunks[ i ] - sl.chunks[ i - 1 ];
-
-				sampling = Math.ceil( samplingCoef * realDistance / sl.total );
-
-				indexCurrent = ( i - 1 ) / ( this.points.length - 1 );
-				indexNext = i / ( this.points.length - 1 );
-
-				for ( j = 1; j < sampling - 1; j ++ ) {
-
-					index = indexCurrent + j * ( 1 / sampling ) * ( indexNext - indexCurrent );
-
-					position = this.getPoint( index );
-					newpoints.push( tmpVec.copy( position ).clone() );
-
-				}
-
-				newpoints.push( tmpVec.copy( this.points[ i ] ).clone() );
-
-			}
-
-			this.points = newpoints;
-
-		};
-
-		// Catmull-Rom
-
-		function interpolate( p0, p1, p2, p3, t, t2, t3 ) {
-
-			var v0 = ( p2 - p0 ) * 0.5,
-				v1 = ( p3 - p1 ) * 0.5;
-
-			return ( 2 * ( p1 - p2 ) + v0 + v1 ) * t3 + ( - 3 * ( p1 - p2 ) - 2 * v0 - v1 ) * t2 + v0 * t + p1;
-
-		}
-
-	}
-
 	/**
 	/**
 	 * @author bhouston / http://clara.io
 	 * @author bhouston / http://clara.io
 	 * @author WestLangley / http://github.com/WestLangley
 	 * @author WestLangley / http://github.com/WestLangley
@@ -41459,45 +41253,6 @@
 
 
 	} )();
 	} )();
 
 
-	/**************************************************************
-	 *	Spline 3D curve
-	 **************************************************************/
-
-
-	var SplineCurve3 = Curve.create(
-
-		function ( points /* array of Vector3 */ ) {
-
-			console.warn( 'THREE.SplineCurve3 will be deprecated. Please use THREE.CatmullRomCurve3' );
-			this.points = ( points === undefined ) ? [] : points;
-
-		},
-
-		function ( t ) {
-
-			var points = this.points;
-			var point = ( points.length - 1 ) * t;
-
-			var intPoint = Math.floor( point );
-			var weight = point - intPoint;
-
-			var point0 = points[ intPoint == 0 ? intPoint : intPoint - 1 ];
-			var point1 = points[ intPoint ];
-			var point2 = points[ intPoint > points.length - 2 ? points.length - 1 : intPoint + 1 ];
-			var point3 = points[ intPoint > points.length - 3 ? points.length - 1 : intPoint + 2 ];
-
-			var interpolate = CurveUtils.interpolate;
-
-			return new Vector3(
-				interpolate( point0.x, point1.x, point2.x, point3.x, weight ),
-				interpolate( point0.y, point1.y, point2.y, point3.y, weight ),
-				interpolate( point0.z, point1.z, point2.z, point3.z, weight )
-			);
-
-		}
-
-	);
-
 	/**************************************************************
 	/**************************************************************
 	 *	Cubic Bezier 3D curve
 	 *	Cubic Bezier 3D curve
 	 **************************************************************/
 	 **************************************************************/
@@ -41799,6 +41554,51 @@
 
 
 	ClosedSplineCurve3.prototype = Object.create( CatmullRomCurve3.prototype );
 	ClosedSplineCurve3.prototype = Object.create( CatmullRomCurve3.prototype );
 
 
+	//
+
+	function SplineCurve3( points ) {
+
+		console.warn( 'THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead.' );
+
+		CatmullRomCurve3.call( this, points );
+		this.type = 'catmullrom';
+
+	}
+
+	SplineCurve3.prototype = Object.create( CatmullRomCurve3.prototype );
+
+	//
+
+	function Spline( points ) {
+
+		console.warn( 'THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead.' );
+
+		CatmullRomCurve3.call( this, points );
+		this.type = 'catmullrom';
+
+	}
+
+	Spline.prototype = Object.create( CatmullRomCurve3.prototype );
+
+	Object.assign( Spline.prototype, {
+
+		initFromArray: function ( a ) {
+
+			console.error( 'THREE.Spline: .initFromArray() has been removed.' );
+
+		},
+		getControlPointsArray: function ( optionalTarget ) {
+
+			console.error( 'THREE.Spline: .getControlPointsArray() has been removed.' );
+
+		},
+		reparametrizeByArcLength: function ( samplingCoef ) {
+
+			console.error( 'THREE.Spline: .reparametrizeByArcLength() has been removed.' );
+
+		}
+
+	} );
 
 
 	//
 	//
 	function BoundingBoxHelper( object, color ) {
 	function BoundingBoxHelper( object, color ) {
@@ -41837,6 +41637,13 @@
 
 
 	}
 	}
 
 
+	function BinaryTextureLoader( manager ) {
+
+		console.warn( 'THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader.' );
+		return new DataTextureLoader( manager );
+
+	}
+
 	//
 	//
 
 
 	Object.assign( Box2.prototype, {
 	Object.assign( Box2.prototype, {
@@ -41984,8 +41791,8 @@
 		},
 		},
 		multiplyVector3: function ( vector ) {
 		multiplyVector3: function ( vector ) {
 
 
-			console.warn( 'THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead.' );
-			return vector.applyProjection( this );
+			console.warn( 'THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead.' );
+			return vector.applyMatrix4( this );
 
 
 		},
 		},
 		multiplyVector4: function ( vector ) {
 		multiplyVector4: function ( vector ) {
@@ -42111,6 +41918,17 @@
 
 
 	} );
 	} );
 
 
+	Object.assign( Vector2.prototype, {
+
+		fromAttribute: function ( attribute, index, offset ) {
+
+			console.error( 'THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute().' );
+			return this.fromBufferAttribute( attribute, index, offset );
+
+		}
+
+	} );
+
 	Object.assign( Vector3.prototype, {
 	Object.assign( Vector3.prototype, {
 
 
 		setEulerFromRotationMatrix: function () {
 		setEulerFromRotationMatrix: function () {
@@ -42140,6 +41958,29 @@
 			console.warn( 'THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().' );
 			console.warn( 'THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().' );
 			return this.setFromMatrixColumn( matrix, index );
 			return this.setFromMatrixColumn( matrix, index );
 
 
+		},
+		applyProjection: function ( m ) {
+
+			console.warn( 'THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead.' );
+			return this.applyMatrix4( m );
+
+		},
+		fromAttribute: function ( attribute, index, offset ) {
+
+			console.error( 'THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute().' );
+			return this.fromBufferAttribute( attribute, index, offset );
+
+		}
+
+	} );
+
+	Object.assign( Vector4.prototype, {
+
+		fromAttribute: function ( attribute, index, offset ) {
+
+			console.error( 'THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute().' );
+			return this.fromBufferAttribute( attribute, index, offset );
+
 		}
 		}
 
 
 	} );
 	} );
@@ -42959,7 +42800,6 @@
 	exports.DepthTexture = DepthTexture;
 	exports.DepthTexture = DepthTexture;
 	exports.Texture = Texture;
 	exports.Texture = Texture;
 	exports.CompressedTextureLoader = CompressedTextureLoader;
 	exports.CompressedTextureLoader = CompressedTextureLoader;
-	exports.BinaryTextureLoader = BinaryTextureLoader;
 	exports.DataTextureLoader = DataTextureLoader;
 	exports.DataTextureLoader = DataTextureLoader;
 	exports.CubeTextureLoader = CubeTextureLoader;
 	exports.CubeTextureLoader = CubeTextureLoader;
 	exports.TextureLoader = TextureLoader;
 	exports.TextureLoader = TextureLoader;
@@ -43029,7 +42869,6 @@
 	exports.CubicInterpolant = CubicInterpolant;
 	exports.CubicInterpolant = CubicInterpolant;
 	exports.Interpolant = Interpolant;
 	exports.Interpolant = Interpolant;
 	exports.Triangle = Triangle;
 	exports.Triangle = Triangle;
-	exports.Spline = Spline;
 	exports.Math = _Math;
 	exports.Math = _Math;
 	exports.Spherical = Spherical;
 	exports.Spherical = Spherical;
 	exports.Cylindrical = Cylindrical;
 	exports.Cylindrical = Cylindrical;
@@ -43065,7 +42904,6 @@
 	exports.ArrowHelper = ArrowHelper;
 	exports.ArrowHelper = ArrowHelper;
 	exports.AxisHelper = AxisHelper;
 	exports.AxisHelper = AxisHelper;
 	exports.CatmullRomCurve3 = CatmullRomCurve3;
 	exports.CatmullRomCurve3 = CatmullRomCurve3;
-	exports.SplineCurve3 = SplineCurve3;
 	exports.CubicBezierCurve3 = CubicBezierCurve3;
 	exports.CubicBezierCurve3 = CubicBezierCurve3;
 	exports.QuadraticBezierCurve3 = QuadraticBezierCurve3;
 	exports.QuadraticBezierCurve3 = QuadraticBezierCurve3;
 	exports.LineCurve3 = LineCurve3;
 	exports.LineCurve3 = LineCurve3;
@@ -43299,10 +43137,13 @@
 	exports.Float32Attribute = Float32Attribute;
 	exports.Float32Attribute = Float32Attribute;
 	exports.Float64Attribute = Float64Attribute;
 	exports.Float64Attribute = Float64Attribute;
 	exports.ClosedSplineCurve3 = ClosedSplineCurve3;
 	exports.ClosedSplineCurve3 = ClosedSplineCurve3;
+	exports.SplineCurve3 = SplineCurve3;
+	exports.Spline = Spline;
 	exports.BoundingBoxHelper = BoundingBoxHelper;
 	exports.BoundingBoxHelper = BoundingBoxHelper;
 	exports.EdgesHelper = EdgesHelper;
 	exports.EdgesHelper = EdgesHelper;
 	exports.WireframeHelper = WireframeHelper;
 	exports.WireframeHelper = WireframeHelper;
 	exports.XHRLoader = XHRLoader;
 	exports.XHRLoader = XHRLoader;
+	exports.BinaryTextureLoader = BinaryTextureLoader;
 	exports.GeometryUtils = GeometryUtils;
 	exports.GeometryUtils = GeometryUtils;
 	exports.ImageUtils = ImageUtils;
 	exports.ImageUtils = ImageUtils;
 	exports.Projector = Projector;
 	exports.Projector = Projector;

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


文件差異過大導致無法顯示
+ 169 - 328
build/three.module.js


+ 5 - 2
docs/list.js

@@ -3,12 +3,15 @@ var list = {
 	"Manual": {
 	"Manual": {
 		"Introduction": [
 		"Introduction": [
 			[ "Creating a scene", "manual/introduction/Creating-a-scene" ],
 			[ "Creating a scene", "manual/introduction/Creating-a-scene" ],
+			[ "Matrix transformations", "manual/introduction/Matrix-transformations" ],
+			[ "Useful links", "manual/introduction/Useful-links" ],
 			[ "Drawing Lines", "manual/introduction/Drawing-lines" ],
 			[ "Drawing Lines", "manual/introduction/Drawing-lines" ],
 			[ "Creating Text", "manual/introduction/Creating-text" ],
 			[ "Creating Text", "manual/introduction/Creating-text" ],
 			[ "Code Style Guide", "manual/introduction/Code-style-guide" ],
 			[ "Code Style Guide", "manual/introduction/Code-style-guide" ],
 			[ "Migration Guide", "manual/introduction/Migration-guide" ],
 			[ "Migration Guide", "manual/introduction/Migration-guide" ],
 			[ "How to run things locally", "manual/introduction/How-to-run-thing-locally" ],
 			[ "How to run things locally", "manual/introduction/How-to-run-thing-locally" ],
-			[ "Matrix transformations", "manual/introduction/Matrix-transformations" ]
+			[ "Matrix transformations", "manual/introduction/Matrix-transformations" ],
+			[ "FAQ", "manual/introduction/FAQ" ]
 		],
 		],
 
 
 		"Build Tools": [
 		"Build Tools": [
@@ -80,7 +83,7 @@ var list = {
 			[ "Layers", "api/core/Layers" ],
 			[ "Layers", "api/core/Layers" ],
 			[ "Object3D", "api/core/Object3D" ],
 			[ "Object3D", "api/core/Object3D" ],
 			[ "Raycaster", "api/core/Raycaster" ],
 			[ "Raycaster", "api/core/Raycaster" ],
-			[ "Uniform", "api/core/Uniform"]
+			[ "Uniform", "api/core/Uniform" ]
 		],
 		],
 
 
 		"Core / BufferAttributes": [
 		"Core / BufferAttributes": [

+ 51 - 0
docs/manual/introduction/FAQ.html

@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html lang="en">
+	<head>
+		<meta charset="utf-8">
+		<base href="../../" />
+		<script src="list.js"></script>
+		<script src="page.js"></script>
+		<link type="text/css" rel="stylesheet" href="page.css" />
+	</head>
+	<body>
+		<h1>[name]</h1>
+
+		<h2>Which Import Format/Exporter is best supported?</h2>
+		<div>
+TODO 
+		</div>
+
+		<h2>Why are there meta viewport tags in examples?</h2>
+		<div>
+			<div class="highlight highlight-text-html-basic"><pre>&lt;<span class="pl-ent">meta</span> <span class="pl-e">name</span>=<span class="pl-s"><span class="pl-pds">"</span>viewport<span class="pl-pds">"</span></span> <span class="pl-e">content</span>=<span class="pl-s"><span class="pl-pds">"</span>width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0<span class="pl-pds">"</span></span>&gt;</pre></div>
+
+				<p>These tags control viewport size and scale for mobile browsers (where page content may be rendered at different size than visible viewport).</p>
+
+				<p><a href="http://developer.apple.com/library/safari/#documentation/AppleApplications/Reference/SafariWebContent/UsingtheViewport/UsingtheViewport.html">http://developer.apple.com/library/safari/#documentation/AppleApplications/Reference/SafariWebContent/UsingtheViewport/UsingtheViewport.html</a></p>
+
+				<p><a href="https://developer.mozilla.org/en/Mobile/Viewport_meta_tag">https://developer.mozilla.org/en/Mobile/Viewport_meta_tag</a></p>
+		</div>
+
+		<h2>How can scene scale be preserved on resize?</h2>
+		<div>
+			We want all objects, regardless of their distance from the camera, to appear the same size, even as the window is resized.
+
+			The key equation to solving this is this formula for the visible height at a given distance:
+
+			<code>s
+visible_height = 2 * Math.tan( ( Math.PI / 180 ) * camera.fov / 2 ) * distance_from_camera;
+			</code>
+			If we increase the window height by a certain percentage, then what we want is the visible height at all distances
+			to increase by the same percentage.
+
+			This can not be done by changing the camera position. Instead you have to change the camera field-of-view.
+			[link:http://jsfiddle.net/Q4Jpu/ Example].
+		</div>
+
+		<h2>Why is part of my object invisible?</h2>
+		<div>
+			This could be because of face culling. Faces have an orientation that  decides which side is which. And the culling removes the backside in normal circumstances. To see if this is your problem, change the material side to THREE.DoubleSide.
+			<code>material.side = THREE.DoubleSide</code>
+		</div>
+	</body>
+</html>

+ 159 - 0
docs/manual/introduction/Useful-links.html

@@ -0,0 +1,159 @@
+<!DOCTYPE html>
+<html lang="en">
+	<head>
+		<meta charset="utf-8">
+		<base href="../../" />
+		<script src="list.js"></script>
+		<script src="page.js"></script>
+		<link type="text/css" rel="stylesheet" href="page.css" />
+	</head>
+	<body>
+		<h1>[name]</h1><br />
+
+		<div class="desc">
+			The following is a collection of links that you might find useful when learning Three.<br />
+			If you find something that you'd like to add here, or think that one of the links below is no longer
+			relevant or working, feel free to click the 'edit' button in the top right and make some changes!<br /><br />
+
+			Note also that as three.js is under rapid development, a lot of these links will contain information that is
+			out of date - if something isn't working as you'd expect or one of these links says it should,
+			check the browser console for warning, the relevant docs pages and especially the [page:DeprecatedList].
+		</div>
+
+		<h2>More documentation</h2>
+		<ul>
+			<li>
+				[link:http://threejsdoc.appspot.com/doc/index.html threejsdoc] - useful because it links every API element to to every official example that uses it.
+			</li>
+			<li>
+				[link:http://ushiroad.com/3j/ Three.js walking map] - a graphical breakdown of the structure of a three.js scene.
+			</li>
+			<li>
+				[link:http://www.reddit.com/r/threejs/ Three.js] subreddit.
+			</li>
+			<li>
+				[link:http://www.reddit.com/r/webgl/ WebGL] subreddit.
+			</li>
+		</ul>
+
+		<h2>News and Updates</h2>
+		<ul>
+			<li>
+				[link:http://learningwebgl.com/blog/ Learning WebGL Blog] – The authoritaive news source for WebGL.
+			</li>
+			<li>
+				[link:https://plus.google.com/104300307601542851567/posts Three.js posts] on Google+ – frequent posts on Three.js
+			</li>
+		</ul>
+
+		<h2>Articles</h2>
+		<ul>
+			<li>
+				[link:http://bkcore.com/blog/3d/webgl-three-js-animated-selective-glow.html Animated selective glow in Three.js]
+				by [link:https://github.com/BKcore BKcore]
+			</li>
+			<li>
+
+			</li>
+			<li>
+
+			</li>
+			<li>
+
+			</li>
+		</ul>
+
+		<h2>Examples</h2>
+		<ul>
+			<li>
+				[link:http://stemkoski.github.io/Three.js/index.html Professor Stemkoskis Examples] - a collection of beginner friendly
+				examples built using three.js r60.
+			</li>
+			<li>
+				[link:https://threejs.org/examples/ Official three.js Examples] - these examples are
+				maintained as part of the three.js repository, and always use the latest version of three.js.
+			</li>
+			<li>
+				[link:https://rawgit.com/mrdoob/three.js/dev/examples/ Official three.js Examples] (dev branch) -
+				Same as the above, except these use the dev branch of three.js,	and are used to check that
+				everything is working as three.js being is developed.
+			</li>
+		</ul>
+
+	 <h2>Tools</h2>
+	 <ul>
+		 <li>
+			[link:http://www.physgl.org/ physgl.org] - javascript front-end with wrappers to three.js, to bring WebGL
+ 			graphics to students learning physics and math.
+		 </li>
+		 <li>
+			 [link:http://whitestormjs.xyz/ Whitestorm.js] – A wrapper around Three.js and custom [link:https://github.com/chandlerprall/Physijs physi.js].
+		 </li>
+
+		<li>
+			[link:http://zz85.github.io/zz85-bookmarklets/threelabs.html Three.js Inspector]
+		</li>
+		<li>
+			[link:http://idflood.github.io/ThreeNodes.js/ ThreeNodes.js].
+		</li>
+	 </ul>
+
+	 <h2>Tutorials and courses</h2>
+	 <ul>
+		 <li>
+			 [link:https://www.udacity.com/course/cs291 Interactive 3D Graphics] - a free course on Udacity that teaches the fundamentals of 3D Graphics,
+			 and uses three.js as it coding tool.
+		 </li>
+		 <li>
+			[Link:https://aerotwist.com/tutorials/ Aerotwist] tutorials by [link:https://github.com/paullewis/ Paul Lewis].
+		 </li>
+		 <li>
+			 [link:http://www.natural-science.or.jp/article/20120220155529.php Building A Physics Simulation Environment] - three.js tutorial in Japanese
+		 </li>
+		 <li>
+			 [link:http://www.senaeh.de/einstieg-in-webgl-mit-three-js/ Einstieg in WebGL mit three.js] - three.js tutorial in German
+		 </li>
+		 <li>
+			 [link:http://learningthreejs.com/ Learning Three.js] – blog where each post is dedicated to teaching an aspect of three.js
+		 </li>
+	 </ul>
+
+	 <h2>Old Links</h2>
+	 <div>
+		These links are kept for historical purposes - you may still find them useful, but be warned that
+		they may have information relating to very old versions of three.js.
+	 </div>
+
+	 <ul>
+		<li>
+			<a href="https://www.youtube.com/watch?v=Dir4KO9RdhM">AlterQualia at WebGL Camp 3</a>
+		</li>
+		<li>
+			[link:http://yomotsu.github.io/threejs-examples/ Yomotsus Examples] - a collection of examples using three.js r45.
+		</li>
+		<li>
+			[link:http://fhtr.org/BasicsOfThreeJS/#1 Introduction to Three.js] by [link:http://github.com/kig/ Ilmari Heikkinen] (slideshow).
+		</li>
+		<li>
+			[link:http://www.slideshare.net/yomotsu/webgl-and-threejs WebGL and Three.js] by [link:http://github.com/yomotsu Akihiro Oyamada] (slideshow).
+		</li>
+		<li>
+			[link:http://bkcore.com/blog/general/adobe-user-group-nl-talk-video-hexgl.html Fast HTML5 game development using three.js] by [link:https://github.com/BKcore BKcore] (video).
+		</li>
+		<li>
+			<a href="http://www.youtube.com/watch?v=VdQnOaolrPA">Trigger Rally</a>  by [link:https://github.com/jareiko jareiko] (video).
+		</li>
+		<li>
+			[link:http://blackjk3.github.io/threefab/ ThreeFab] - scene editor, maintained up until around three.js r50.
+		</li>
+		<li>
+			[link:http://bkcore.com/blog/3d/webgl-three-js-workflow-tips.html Max to Three.js workflow tips and tricks] by https://github.com/BKcore BKcore]
+		</li>
+		<li>
+			[link:http://12devsofxmas.co.uk/2012/01/webgl-and-three-js/ On the twelfth day of Xmas, take a whirlwind look at Three.js]
+			by [link:http://github.com/nrocy Paul King]
+		</li>
+	 </ul>
+
+	</body>
+</html>

+ 14 - 4
editor/js/Menubar.File.js

@@ -4,6 +4,16 @@
 
 
 Menubar.File = function ( editor ) {
 Menubar.File = function ( editor ) {
 
 
+	var NUMBER_PRECISION = 6;
+
+	function parseNumber( key, value ) {
+
+		return typeof value === 'number' ? parseFloat( value.toFixed( NUMBER_PRECISION ) ) : value;
+
+	}
+
+	//
+
 	var container = new UI.Panel();
 	var container = new UI.Panel();
 	container.setClass( 'menu' );
 	container.setClass( 'menu' );
 
 
@@ -89,7 +99,7 @@ Menubar.File = function ( editor ) {
 
 
 		try {
 		try {
 
 
-			output = JSON.stringify( output, null, '\t' );
+			output = JSON.stringify( output, parseNumber, '\t' );
 			output = output.replace( /[\n\t]+([\d\.e\-\[\]]+)/g, '$1' );
 			output = output.replace( /[\n\t]+([\d\.e\-\[\]]+)/g, '$1' );
 
 
 		} catch ( e ) {
 		} catch ( e ) {
@@ -123,7 +133,7 @@ Menubar.File = function ( editor ) {
 
 
 		try {
 		try {
 
 
-			output = JSON.stringify( output, null, '\t' );
+			output = JSON.stringify( output, parseNumber, '\t' );
 			output = output.replace( /[\n\t]+([\d\.e\-\[\]]+)/g, '$1' );
 			output = output.replace( /[\n\t]+([\d\.e\-\[\]]+)/g, '$1' );
 
 
 		} catch ( e ) {
 		} catch ( e ) {
@@ -148,7 +158,7 @@ Menubar.File = function ( editor ) {
 
 
 		try {
 		try {
 
 
-			output = JSON.stringify( output, null, '\t' );
+			output = JSON.stringify( output, parseNumber, '\t' );
 			output = output.replace( /[\n\t]+([\d\.e\-\[\]]+)/g, '$1' );
 			output = output.replace( /[\n\t]+([\d\.e\-\[\]]+)/g, '$1' );
 
 
 		} catch ( e ) {
 		} catch ( e ) {
@@ -220,7 +230,7 @@ Menubar.File = function ( editor ) {
 
 
 		var vr = output.project.vr;
 		var vr = output.project.vr;
 
 
-		output = JSON.stringify( output, null, '\t' );
+		output = JSON.stringify( output, parseNumber, '\t' );
 		output = output.replace( /[\n\t]+([\d\.e\-\[\]]+)/g, '$1' );
 		output = output.replace( /[\n\t]+([\d\.e\-\[\]]+)/g, '$1' );
 
 
 		zip.file( 'app.json', output );
 		zip.file( 'app.json', output );

+ 7 - 0
examples/js/loaders/GLTFLoader.js

@@ -1487,6 +1487,13 @@ THREE.GLTFLoader = ( function () {
 							var mesh = node.meshes[ meshId ];
 							var mesh = node.meshes[ meshId ];
 							var group = dependencies.meshes[ mesh ];
 							var group = dependencies.meshes[ mesh ];
 
 
+							if ( group === undefined ) {
+
+								console.warn( 'GLTFLoader: Couldn\'t find node "' + mesh + '".' );
+								continue;
+
+							}
+
 							for ( var childrenId in group.children ) {
 							for ( var childrenId in group.children ) {
 
 
 								var child = group.children[ childrenId ];
 								var child = group.children[ childrenId ];

+ 1 - 0
examples/js/postprocessing/AdaptiveToneMappingPass.js

@@ -119,6 +119,7 @@ THREE.AdaptiveToneMappingPass = function ( adaptive, resolution ) {
 	this.scene  = new THREE.Scene();
 	this.scene  = new THREE.Scene();
 
 
 	this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
 	this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
+	this.quad.frustumCulled = false; // Avoid getting clipped
 	this.scene.add( this.quad );
 	this.scene.add( this.quad );
 
 
 };
 };

+ 1 - 0
examples/js/postprocessing/BloomPass.js

@@ -69,6 +69,7 @@ THREE.BloomPass = function ( strength, kernelSize, sigma, resolution ) {
 	this.scene  = new THREE.Scene();
 	this.scene  = new THREE.Scene();
 
 
 	this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
 	this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
+	this.quad.frustumCulled = false; // Avoid getting clipped
 	this.scene.add( this.quad );
 	this.scene.add( this.quad );
 
 
 };
 };

+ 1 - 0
examples/js/postprocessing/BokehPass.js

@@ -63,6 +63,7 @@ THREE.BokehPass = function ( scene, camera, params ) {
 	this.scene2  = new THREE.Scene();
 	this.scene2  = new THREE.Scene();
 
 
 	this.quad2 = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
 	this.quad2 = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
+	this.quad2.frustumCulled = false; // Avoid getting clipped
 	this.scene2.add( this.quad2 );
 	this.scene2.add( this.quad2 );
 
 
 };
 };

+ 1 - 0
examples/js/postprocessing/DotScreenPass.js

@@ -29,6 +29,7 @@ THREE.DotScreenPass = function ( center, angle, scale ) {
 	this.scene  = new THREE.Scene();
 	this.scene  = new THREE.Scene();
 
 
 	this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
 	this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
+	this.quad.frustumCulled = false; // Avoid getting clipped
 	this.scene.add( this.quad );
 	this.scene.add( this.quad );
 
 
 };
 };

+ 1 - 0
examples/js/postprocessing/FilmPass.js

@@ -30,6 +30,7 @@ THREE.FilmPass = function ( noiseIntensity, scanlinesIntensity, scanlinesCount,
 	this.scene  = new THREE.Scene();
 	this.scene  = new THREE.Scene();
 
 
 	this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
 	this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
+	this.quad.frustumCulled = false; // Avoid getting clipped
 	this.scene.add( this.quad );
 	this.scene.add( this.quad );
 
 
 };
 };

+ 1 - 0
examples/js/postprocessing/GlitchPass.js

@@ -27,6 +27,7 @@ THREE.GlitchPass = function ( dt_size ) {
 	this.scene  = new THREE.Scene();
 	this.scene  = new THREE.Scene();
 
 
 	this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
 	this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
+	this.quad.frustumCulled = false; // Avoid getting clipped
 	this.scene.add( this.quad );
 	this.scene.add( this.quad );
 
 
 	this.goWild = false;
 	this.goWild = false;

+ 1 - 0
examples/js/postprocessing/OutlinePass.js

@@ -97,6 +97,7 @@ THREE.OutlinePass = function ( resolution, scene, camera, selectedObjects ) {
 	this.scene = new THREE.Scene();
 	this.scene = new THREE.Scene();
 
 
 	this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
 	this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
+	this.quad.frustumCulled = false; // Avoid getting clipped
 	this.scene.add( this.quad );
 	this.scene.add( this.quad );
 
 
 	this.tempPulseColor1 = new THREE.Color();
 	this.tempPulseColor1 = new THREE.Color();

+ 1 - 0
examples/js/postprocessing/SMAAPass.js

@@ -100,6 +100,7 @@ THREE.SMAAPass = function ( width, height ) {
 	this.scene  = new THREE.Scene();
 	this.scene  = new THREE.Scene();
 
 
 	this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
 	this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
+	this.quad.frustumCulled = false; // Avoid getting clipped
 	this.scene.add( this.quad );
 	this.scene.add( this.quad );
 
 
 };
 };

+ 1 - 0
examples/js/postprocessing/SSAARenderPass.js

@@ -43,6 +43,7 @@ THREE.SSAARenderPass = function ( scene, camera, clearColor, clearAlpha ) {
 	this.camera2 = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );
 	this.camera2 = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );
 	this.scene2	= new THREE.Scene();
 	this.scene2	= new THREE.Scene();
 	this.quad2 = new THREE.Mesh( new THREE.PlaneGeometry( 2, 2 ), this.copyMaterial );
 	this.quad2 = new THREE.Mesh( new THREE.PlaneGeometry( 2, 2 ), this.copyMaterial );
+	this.quad2.frustumCulled = false; // Avoid getting clipped
 	this.scene2.add( this.quad2 );
 	this.scene2.add( this.quad2 );
 
 
 };
 };

+ 1 - 0
examples/js/postprocessing/SavePass.js

@@ -38,6 +38,7 @@ THREE.SavePass = function ( renderTarget ) {
 	this.scene  = new THREE.Scene();
 	this.scene  = new THREE.Scene();
 
 
 	this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
 	this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
+	this.quad.frustumCulled = false; // Avoid getting clipped
 	this.scene.add( this.quad );
 	this.scene.add( this.quad );
 
 
 };
 };

+ 1 - 0
examples/js/postprocessing/ShaderPass.js

@@ -33,6 +33,7 @@ THREE.ShaderPass = function ( shader, textureID ) {
 	this.scene = new THREE.Scene();
 	this.scene = new THREE.Scene();
 
 
 	this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
 	this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
+	this.quad.frustumCulled = false; // Avoid getting clipped
 	this.scene.add( this.quad );
 	this.scene.add( this.quad );
 
 
 };
 };

+ 1 - 0
examples/js/postprocessing/TexturePass.js

@@ -32,6 +32,7 @@ THREE.TexturePass = function ( map, opacity ) {
 	this.scene  = new THREE.Scene();
 	this.scene  = new THREE.Scene();
 
 
 	this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
 	this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
+	this.quad.frustumCulled = false; // Avoid getting clipped
 	this.scene.add( this.quad );
 	this.scene.add( this.quad );
 
 
 };
 };

+ 1 - 0
examples/js/postprocessing/UnrealBloomPass.js

@@ -124,6 +124,7 @@ THREE.UnrealBloomPass = function ( resolution, strength, radius, threshold ) {
 	this.scene  = new THREE.Scene();
 	this.scene  = new THREE.Scene();
 
 
 	this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
 	this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
+	this.quad.frustumCulled = false; // Avoid getting clipped
 	this.scene.add( this.quad );
 	this.scene.add( this.quad );
 
 
 };
 };

+ 40 - 38
src/loaders/ImageLoader.js

@@ -1,10 +1,11 @@
-import { FileLoader } from './FileLoader';
-import { DefaultLoadingManager } from './LoadingManager';
-
 /**
 /**
  * @author mrdoob / http://mrdoob.com/
  * @author mrdoob / http://mrdoob.com/
  */
  */
 
 
+import { Cache } from './Cache';
+import { DefaultLoadingManager } from './LoadingManager';
+
+
 function ImageLoader( manager ) {
 function ImageLoader( manager ) {
 
 
 	this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager;
 	this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager;
@@ -15,56 +16,64 @@ Object.assign( ImageLoader.prototype, {
 
 
 	load: function ( url, onLoad, onProgress, onError ) {
 	load: function ( url, onLoad, onProgress, onError ) {
 
 
+		if ( url === undefined ) url = '';
+
+		if ( this.path !== undefined ) url = this.path + url;
+
 		var scope = this;
 		var scope = this;
 
 
-		var image = document.createElementNS( 'http://www.w3.org/1999/xhtml', 'img' );
-		image.onload = function () {
+		var cached = Cache.get( url );
 
 
-			image.onload = null;
+		if ( cached !== undefined ) {
 
 
-			URL.revokeObjectURL( image.src );
+			scope.manager.itemStart( url );
 
 
-			if ( onLoad ) onLoad( image );
+			setTimeout( function () {
 
 
-			scope.manager.itemEnd( url );
+				if ( onLoad ) onLoad( cached );
+
+				scope.manager.itemEnd( url );
+
+			}, 0 );
+
+			return cached;
 
 
-		};
-		image.onerror = onError;
+		}
+
+		var image = document.createElementNS( 'http://www.w3.org/1999/xhtml', 'img' );
 
 
-		if ( url.indexOf( 'data:' ) === 0 ) {
+		image.addEventListener( 'load', function () {
 
 
-			image.src = url;
+			THREE.Cache.add( url, this );
 
 
-		} else if ( this.crossOrigin !== undefined ) {
+			if ( onLoad ) onLoad( this );
 
 
-			// crossOrigin doesn't work with URL.createObjectURL()?
+			scope.manager.itemEnd( url );
 
 
-			image.crossOrigin = this.crossOrigin;
-			image.src = url;
+		}, false );
 
 
-		} else {
+		/*
+		image.addEventListener( 'progress', function ( event ) {
 
 
-			var loader = new FileLoader();
-			loader.setPath( this.path );
-			loader.setResponseType( 'blob' );
-			loader.setWithCredentials( this.withCredentials );
+			if ( onProgress ) onProgress( event );
 
 
-			// By default the FileLoader requests files to be loaded with a MIME
-			// type of `text/plain`. Using `URL.createObjectURL()` with SVGs that
-			// have a MIME type of `text/plain` results in an error, so explicitly
-			// set the SVG MIME type.
-			if ( /\.svg$/.test( url ) ) loader.setMimeType( 'image/svg+xml' );
+		}, false );
+		*/
 
 
-			loader.load( url, function ( blob ) {
+		image.addEventListener( 'error', function ( event ) {
 
 
-				image.src = URL.createObjectURL( blob );
+			if ( onError ) onError( event );
 
 
-			}, onProgress, onError );
+			scope.manager.itemError( url );
 
 
-		}
+		}, false );
+
+		if ( this.crossOrigin !== undefined ) image.crossOrigin = this.crossOrigin;
 
 
 		scope.manager.itemStart( url );
 		scope.manager.itemStart( url );
 
 
+		image.src = url;
+
 		return image;
 		return image;
 
 
 	},
 	},
@@ -76,13 +85,6 @@ Object.assign( ImageLoader.prototype, {
 
 
 	},
 	},
 
 
-	setWithCredentials: function ( value ) {
-
-		this.withCredentials = value;
-		return this;
-
-	},
-
 	setPath: function ( value ) {
 	setPath: function ( value ) {
 
 
 		this.path = value;
 		this.path = value;

+ 4 - 13
src/loaders/TextureLoader.js

@@ -1,11 +1,12 @@
+/**
+ * @author mrdoob / http://mrdoob.com/
+ */
+
 import { RGBAFormat, RGBFormat } from '../constants';
 import { RGBAFormat, RGBFormat } from '../constants';
 import { ImageLoader } from './ImageLoader';
 import { ImageLoader } from './ImageLoader';
 import { Texture } from '../textures/Texture';
 import { Texture } from '../textures/Texture';
 import { DefaultLoadingManager } from './LoadingManager';
 import { DefaultLoadingManager } from './LoadingManager';
 
 
-/**
- * @author mrdoob / http://mrdoob.com/
- */
 
 
 function TextureLoader( manager ) {
 function TextureLoader( manager ) {
 
 
@@ -21,7 +22,6 @@ Object.assign( TextureLoader.prototype, {
 
 
 		var loader = new ImageLoader( this.manager );
 		var loader = new ImageLoader( this.manager );
 		loader.setCrossOrigin( this.crossOrigin );
 		loader.setCrossOrigin( this.crossOrigin );
-		loader.setWithCredentials( this.withCredentials );
 		loader.setPath( this.path );
 		loader.setPath( this.path );
 		loader.load( url, function ( image ) {
 		loader.load( url, function ( image ) {
 
 
@@ -51,13 +51,6 @@ Object.assign( TextureLoader.prototype, {
 
 
 	},
 	},
 
 
-	setWithCredentials: function ( value ) {
-
-		this.withCredentials = value;
-		return this;
-
-	},
-
 	setPath: function ( value ) {
 	setPath: function ( value ) {
 
 
 		this.path = value;
 		this.path = value;
@@ -65,8 +58,6 @@ Object.assign( TextureLoader.prototype, {
 
 
 	}
 	}
 
 
-
-
 } );
 } );
 
 
 
 

+ 3 - 1
src/objects/Mesh.js

@@ -259,11 +259,13 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), {
 			} else if ( geometry.isGeometry ) {
 			} else if ( geometry.isGeometry ) {
 
 
 				var fvA, fvB, fvC;
 				var fvA, fvB, fvC;
-				var isFaceMaterial = (material && material.isMultiMaterial);
+				var isFaceMaterial = ( material && material.isMultiMaterial );
 				var materials = isFaceMaterial === true ? material.materials : null;
 				var materials = isFaceMaterial === true ? material.materials : null;
 
 
 				var vertices = geometry.vertices;
 				var vertices = geometry.vertices;
 				var faces = geometry.faces;
 				var faces = geometry.faces;
+				var uvs;
+
 				var faceVertexUvs = geometry.faceVertexUvs[ 0 ];
 				var faceVertexUvs = geometry.faceVertexUvs[ 0 ];
 				if ( faceVertexUvs.length > 0 ) uvs = faceVertexUvs;
 				if ( faceVertexUvs.length > 0 ) uvs = faceVertexUvs;
 
 

+ 2 - 2
utils/exporters/blender/addons/io_three/constants.py

@@ -159,12 +159,12 @@ EXPORT_OPTIONS = {
     EMBED_TEXTURES: False,
     EMBED_TEXTURES: False,
     TEXTURE_FOLDER: '',
     TEXTURE_FOLDER: '',
     LOGGING: DEBUG,
     LOGGING: DEBUG,
-    ENABLE_PRECISION: True,
+    ENABLE_PRECISION: False,
     PRECISION: DEFAULT_PRECISION,
     PRECISION: DEFAULT_PRECISION,
     CUSTOM_PROPERTIES: False,
     CUSTOM_PROPERTIES: False,
     EMBED_GEOMETRY: True,
     EMBED_GEOMETRY: True,
     EMBED_ANIMATION: True,
     EMBED_ANIMATION: True,
-    GEOMETRY_TYPE: GEOMETRY,
+    GEOMETRY_TYPE: BUFFER_GEOMETRY,
     INFLUENCES_PER_VERTEX: 2,
     INFLUENCES_PER_VERTEX: 2,
     INDENT: True
     INDENT: True
 }
 }

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