瀏覽代碼

Updated builds.

Mr.doob 11 年之前
父節點
當前提交
aa360af4b6
共有 2 個文件被更改,包括 177 次插入165 次删除
  1. 79 64
      build/three.js
  2. 98 101
      build/three.min.js

+ 79 - 64
build/three.js

@@ -8252,7 +8252,9 @@ THREE.Projector = function () {
 
 
 						} else {
 						} else {
 
 
-							for ( var i = 0, l = ( positions.length / 3 ) - 1; i < l; i ++ ) {
+							var step = object.type === THREE.LinePieces ? 2 : 1;
+
+							for ( var i = 0, l = ( positions.length / 3 ) - 1; i < l; i += step ) {
 
 
 								renderList.pushLine( i, i + 1 );
 								renderList.pushLine( i, i + 1 );
 
 
@@ -11511,7 +11513,7 @@ THREE.XHRLoader.prototype = {
 
 
 		if ( cached !== undefined ) {
 		if ( cached !== undefined ) {
 
 
-			onLoad( cached );
+			if ( onLoad ) onLoad( cached );
 			return;
 			return;
 
 
 		}
 		}
@@ -11519,18 +11521,15 @@ THREE.XHRLoader.prototype = {
 		var request = new XMLHttpRequest();
 		var request = new XMLHttpRequest();
 		request.open( 'GET', url, true );
 		request.open( 'GET', url, true );
 
 
-		if ( onLoad !== undefined ) {
-
-			request.addEventListener( 'load', function ( event ) {
+		request.addEventListener( 'load', function ( event ) {
 
 
-				scope.cache.add( url, this.response );
+			scope.cache.add( url, this.response );
 
 
-				onLoad( this.response );
-				scope.manager.itemEnd( url );
+			if ( onLoad ) onLoad( this.response );
 
 
-			}, false );
+			scope.manager.itemEnd( url );
 
 
-		}
+		}, false );
 
 
 		if ( onProgress !== undefined ) {
 		if ( onProgress !== undefined ) {
 
 
@@ -12267,7 +12266,7 @@ THREE.BufferGeometryLoader.prototype = {
 
 
 			onLoad( scope.parse( JSON.parse( text ) ) );
 			onLoad( scope.parse( JSON.parse( text ) ) );
 
 
-		} );
+		}, onProgress, onError );
 
 
 	},
 	},
 
 
@@ -12282,8 +12281,6 @@ THREE.BufferGeometryLoader.prototype = {
 		var geometry = new THREE.BufferGeometry();
 		var geometry = new THREE.BufferGeometry();
 
 
 		var attributes = json.attributes;
 		var attributes = json.attributes;
-		var offsets = json.offsets;
-		var boundingSphere = json.boundingSphere;
 
 
 		for ( var key in attributes ) {
 		for ( var key in attributes ) {
 
 
@@ -12296,12 +12293,16 @@ THREE.BufferGeometryLoader.prototype = {
 
 
 		}
 		}
 
 
+		var offsets = json.offsets;
+
 		if ( offsets !== undefined ) {
 		if ( offsets !== undefined ) {
 
 
 			geometry.offsets = JSON.parse( JSON.stringify( offsets ) );
 			geometry.offsets = JSON.parse( JSON.stringify( offsets ) );
 
 
 		}
 		}
 
 
+		var boundingSphere = json.boundingSphere;
+
 		if ( boundingSphere !== undefined ) {
 		if ( boundingSphere !== undefined ) {
 
 
 			geometry.boundingSphere = new THREE.Sphere(
 			geometry.boundingSphere = new THREE.Sphere(
@@ -12341,7 +12342,7 @@ THREE.MaterialLoader.prototype = {
 
 
 			onLoad( scope.parse( JSON.parse( text ) ) );
 			onLoad( scope.parse( JSON.parse( text ) ) );
 
 
-		} );
+		}, onProgress, onError );
 
 
 	},
 	},
 
 
@@ -12407,7 +12408,7 @@ THREE.ObjectLoader.prototype = {
 
 
 			onLoad( scope.parse( JSON.parse( text ) ) );
 			onLoad( scope.parse( JSON.parse( text ) ) );
 
 
-		} );
+		}, onProgress, onError );
 
 
 	},
 	},
 
 
@@ -12761,7 +12762,7 @@ THREE.TextureLoader.prototype = {
 
 
 			}
 			}
 
 
-		} );
+		}, onProgress, onError );
 
 
 	},
 	},
 
 
@@ -33557,44 +33558,8 @@ THREE.ArrowHelper.prototype.setColor = function ( color ) {
 
 
 THREE.BoxHelper = function ( object ) {
 THREE.BoxHelper = function ( object ) {
 
 
-	//   5____4
-	// 1/___0/|
-	// | 6__|_7
-	// 2/___3/
-
-	var vertices = [
-		new THREE.Vector3(   1,   1,   1 ),
-		new THREE.Vector3( - 1,   1,   1 ),
-		new THREE.Vector3( - 1, - 1,   1 ),
-		new THREE.Vector3(   1, - 1,   1 ),
-
-		new THREE.Vector3(   1,   1, - 1 ),
-		new THREE.Vector3( - 1,   1, - 1 ),
-		new THREE.Vector3( - 1, - 1, - 1 ),
-		new THREE.Vector3(   1, - 1, - 1 )
-	];
-
-	this.vertices = vertices;
-
-	// TODO: Wouldn't be nice if Line had .segments?
-
-	var geometry = new THREE.Geometry();
-	geometry.vertices.push(
-		vertices[ 0 ], vertices[ 1 ],
-		vertices[ 1 ], vertices[ 2 ],
-		vertices[ 2 ], vertices[ 3 ],
-		vertices[ 3 ], vertices[ 0 ],
-
-		vertices[ 4 ], vertices[ 5 ],
-		vertices[ 5 ], vertices[ 6 ],
-		vertices[ 6 ], vertices[ 7 ],
-		vertices[ 7 ], vertices[ 4 ],
-
-		vertices[ 0 ], vertices[ 4 ],
-		vertices[ 1 ], vertices[ 5 ],
-		vertices[ 2 ], vertices[ 6 ],
-		vertices[ 3 ], vertices[ 7 ]
-	);
+	var geometry = new THREE.BufferGeometry();
+	geometry.addAttribute( 'position', new THREE.BufferAttribute( new Float32Array( 72 ), 3 ) );
 
 
 	THREE.Line.call( this, geometry, new THREE.LineBasicMaterial( { color: 0xffff00 } ), THREE.LinePieces );
 	THREE.Line.call( this, geometry, new THREE.LineBasicMaterial( { color: 0xffff00 } ), THREE.LinePieces );
 
 
@@ -33620,19 +33585,69 @@ THREE.BoxHelper.prototype.update = function ( object ) {
 
 
 	var min = geometry.boundingBox.min;
 	var min = geometry.boundingBox.min;
 	var max = geometry.boundingBox.max;
 	var max = geometry.boundingBox.max;
-	var vertices = this.vertices;
 
 
-	vertices[ 0 ].set( max.x, max.y, max.z );
-	vertices[ 1 ].set( min.x, max.y, max.z );
-	vertices[ 2 ].set( min.x, min.y, max.z );
-	vertices[ 3 ].set( max.x, min.y, max.z );
-	vertices[ 4 ].set( max.x, max.y, min.z );
-	vertices[ 5 ].set( min.x, max.y, min.z );
-	vertices[ 6 ].set( min.x, min.y, min.z );
-	vertices[ 7 ].set( max.x, min.y, min.z );
+
+	/*
+	  5____4
+	1/___0/|
+	| 6__|_7
+	2/___3/
+
+	0: max.x, max.y, max.z
+	1: min.x, max.y, max.z
+	2: min.x, min.y, max.z
+	3: max.x, min.y, max.z
+	4: max.x, max.y, min.z
+	5: min.x, max.y, min.z
+	6: min.x, min.y, min.z
+	7: max.x, min.y, min.z
+	*/
+
+	var vertices = this.geometry.attributes.position.array;
+
+	vertices[  0 ] = max.x; vertices[  1 ] = max.y; vertices[  2 ] = max.z;
+	vertices[  3 ] = min.x; vertices[  4 ] = max.y; vertices[  5 ] = max.z;
+
+	vertices[  6 ] = min.x; vertices[  7 ] = max.y; vertices[  8 ] = max.z;
+	vertices[  9 ] = min.x; vertices[ 10 ] = min.y; vertices[ 11 ] = max.z;
+
+	vertices[ 12 ] = min.x; vertices[ 13 ] = min.y; vertices[ 14 ] = max.z;
+	vertices[ 15 ] = max.x; vertices[ 16 ] = min.y; vertices[ 17 ] = max.z;
+
+	vertices[ 18 ] = max.x; vertices[ 19 ] = min.y; vertices[ 20 ] = max.z;
+	vertices[ 21 ] = max.x; vertices[ 22 ] = max.y; vertices[ 23 ] = max.z;
+
+	//
+
+	vertices[ 24 ] = max.x; vertices[ 25 ] = max.y; vertices[ 26 ] = min.z;
+	vertices[ 27 ] = min.x; vertices[ 28 ] = max.y; vertices[ 29 ] = min.z;
+
+	vertices[ 30 ] = min.x; vertices[ 31 ] = max.y; vertices[ 32 ] = min.z;
+	vertices[ 33 ] = min.x; vertices[ 34 ] = min.y; vertices[ 35 ] = min.z;
+
+	vertices[ 36 ] = min.x; vertices[ 37 ] = min.y; vertices[ 38 ] = min.z;
+	vertices[ 39 ] = max.x; vertices[ 40 ] = min.y; vertices[ 41 ] = min.z;
+
+	vertices[ 42 ] = max.x; vertices[ 43 ] = min.y; vertices[ 44 ] = min.z;
+	vertices[ 45 ] = max.x; vertices[ 46 ] = max.y; vertices[ 47 ] = min.z;
+
+	//
+
+	vertices[ 48 ] = max.x; vertices[ 49 ] = max.y; vertices[ 50 ] = max.z;
+	vertices[ 51 ] = max.x; vertices[ 52 ] = max.y; vertices[ 53 ] = min.z;
+
+	vertices[ 54 ] = min.x; vertices[ 55 ] = max.y; vertices[ 56 ] = max.z;
+	vertices[ 57 ] = min.x; vertices[ 58 ] = max.y; vertices[ 59 ] = min.z;
+
+	vertices[ 60 ] = min.x; vertices[ 61 ] = min.y; vertices[ 62 ] = max.z;
+	vertices[ 63 ] = min.x; vertices[ 64 ] = min.y; vertices[ 65 ] = min.z;
+
+	vertices[ 66 ] = max.x; vertices[ 67 ] = min.y; vertices[ 68 ] = max.z;
+	vertices[ 69 ] = max.x; vertices[ 70 ] = min.y; vertices[ 71 ] = min.z;
+
+	this.geometry.attributes.position.needsUpdate = true;
 
 
 	this.geometry.computeBoundingSphere();
 	this.geometry.computeBoundingSphere();
-	this.geometry.verticesNeedUpdate = true;
 
 
 	this.matrixAutoUpdate = false;
 	this.matrixAutoUpdate = false;
 	this.matrixWorld = object.matrixWorld;
 	this.matrixWorld = object.matrixWorld;

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


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