瀏覽代碼

Updated builds.

Mr.doob 11 年之前
父節點
當前提交
94e960b53b
共有 2 個文件被更改,包括 154 次插入96 次删除
  1. 99 41
      build/three.js
  2. 55 55
      build/three.min.js

+ 99 - 41
build/three.js

@@ -19197,9 +19197,14 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		if ( geometry.__webglCustomAttributesList !== undefined ) {
 
-			for ( var id in geometry.__webglCustomAttributesList ) {
+			var attributes = geometry.__webglCustomAttributesList;
+			var keys = Object.keys( attributes );
 
-				_gl.deleteBuffer( geometry.__webglCustomAttributesList[ id ].buffer );
+			for ( var i = 0; i < keys.length; i ++ ) {
+
+				var name = keys[ i ];
+
+				_gl.deleteBuffer( attributes[ name ].buffer );
 
 			}
 
@@ -19216,12 +19221,15 @@ THREE.WebGLRenderer = function ( parameters ) {
 		if ( geometry instanceof THREE.BufferGeometry ) {
 
 			var attributes = geometry.attributes;
+			var keys = Object.keys( attributes );
+
+			for ( var i = 0; i < keys.length; i ++ ) {
 
-			for ( var key in attributes ) {
+				var name = keys[ i ];
 
-				if ( attributes[ key ].buffer !== undefined ) {
+				if ( attributes[ name ].buffer !== undefined ) {
 
-					_gl.deleteBuffer( attributes[ key ].buffer );
+					_gl.deleteBuffer( attributes[ name ].buffer );
 
 				}
 
@@ -19395,9 +19403,12 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			}
 
-			for ( var a in material.attributes ) {
+			var keys = Object.keys( material.attributes );
 
-				var attribute = material.attributes[ a ];
+			for ( var i = 0; i < keys.length; i ++ ) {
+
+				var name = keys[ i ];
+				var attribute = material.attributes[ name ];
 
 				if ( ! attribute.__webglInitialized || attribute.createUniqueBuffers ) {
 
@@ -19415,7 +19426,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 					attribute.array = new Float32Array( nvertices * size );
 
 					attribute.buffer = _gl.createBuffer();
-					attribute.buffer.belongsToAttribute = a;
+					attribute.buffer.belongsToAttribute = name;
 
 					attribute.needsUpdate = true;
 
@@ -19539,17 +19550,23 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			}
 
-			for ( var a in material.attributes ) {
+			var keys = Object.keys( material.attributes );
+
+			for ( var i = 0; i < keys.length; i ++ ) {
 
 				// Do a shallow copy of the attribute object so different geometryGroup chunks use different
 				// attribute buffers which are correctly indexed in the setMeshBuffers function
 
-				var originalAttribute = material.attributes[ a ];
+				var name = keys[ i ];
+				var originalAttribute = material.attributes[ name ];
 
 				var attribute = {};
 
-				for ( var property in originalAttribute ) {
+				var keys2 = Object.keys( originalAttribute );
 
+				for ( var j = 0; j < keys2.length; j ++ ) {
+
+					var property = keys2[ j ];
 					attribute[ property ] = originalAttribute[ property ];
 
 				}
@@ -19570,7 +19587,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 					attribute.array = new Float32Array( nvertices * size );
 
 					attribute.buffer = _gl.createBuffer();
-					attribute.buffer.belongsToAttribute = a;
+					attribute.buffer.belongsToAttribute = name;
 
 					originalAttribute.needsUpdate = true;
 					attribute.__original = originalAttribute;
@@ -19605,7 +19622,11 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	function initDirectBuffers( geometry ) {
 
-		for ( var name in geometry.attributes ) {
+		var keys = Object.keys( geometry.attributes );
+
+		for ( var i = 0; i < keys.length; i ++ ) {
+
+			var name = keys[ i ];
 
 			var bufferType = ( name === 'index' ) ? _gl.ELEMENT_ARRAY_BUFFER : _gl.ARRAY_BUFFER;
 
@@ -20917,11 +20938,12 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		var attributes = geometry.attributes;
 
-		var attributeName, attributeItem;
+		var keys = Object.keys( attributes );
 
-		for ( attributeName in attributes ) {
+		for ( var i = 0; i < keys.length; i ++ ) {
 
-			attributeItem = attributes[ attributeName ];
+			var attributeName = keys[ i ];
+			var attributeItem = attributes[ attributeName ];
 
 			if ( attributeItem.needsUpdate ) {
 
@@ -21046,10 +21068,14 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	function setupVertexAttributes( material, programAttributes, geometryAttributes, startIndex ) {
 
-		for ( var attributeName in programAttributes ) {
+		var keys = Object.keys( programAttributes );
+
+		for ( var i = 0; i < keys.length; i ++ ) {
+
+			var attributeName = keys[ i ];
 
-			var attributePointer = programAttributes[ attributeName ];
 			var attributeItem = geometryAttributes[ attributeName ];
+			var attributePointer = programAttributes[ attributeName ];
 
 			if ( attributePointer >= 0 ) {
 
@@ -22483,9 +22509,13 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	function areCustomAttributesDirty( material ) {
 
-		for ( var a in material.attributes ) {
+		var keys = Object.keys( material.attributes );
+
+		for ( var i = 0; i < keys.length; i ++ ) {
+
+			var name = keys[ i ];
 
-			if ( material.attributes[ a ].needsUpdate ) return true;
+			if ( material.attributes[ name ].needsUpdate ) return true;
 
 		}
 
@@ -22495,9 +22525,13 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	function clearCustomAttributes( material ) {
 
-		for ( var a in material.attributes ) {
+		var keys = Object.keys( material.attributes );
 
-			material.attributes[ a ].needsUpdate = false;
+		for ( var i = 0; i < keys.length; i ++ ) {
+
+			var name = keys[ i ];
+
+			material.attributes[ name ].needsUpdate = false;
 
 		}
 
@@ -22549,7 +22583,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		material.addEventListener( 'dispose', onMaterialDispose );
 
-		var u, a, identifiers, i, parameters, maxLightCount, maxBones, maxShadows, shaderID;
+		var shaderID;
 
 		if ( material instanceof THREE.MeshDepthMaterial ) {
 
@@ -22608,13 +22642,11 @@ THREE.WebGLRenderer = function ( parameters ) {
 		// heuristics to create shader parameters according to lights in the scene
 		// (not to blow over maxLights budget)
 
-		maxLightCount = allocateLights( lights );
-
-		maxShadows = allocateShadows( lights );
-
-		maxBones = allocateBones( object );
+		var maxLightCount = allocateLights( lights );
+		var maxShadows = allocateShadows( lights );
+		var maxBones = allocateBones( object );
 
-		parameters = {
+		var parameters = {
 
 			precision: _precision,
 			supportsVertexTextures: _supportsVertexTextures,
@@ -22679,14 +22711,28 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		}
 
-		for ( var d in material.defines ) {
+		var keys;
 
-			chunks.push( d );
-			chunks.push( material.defines[ d ] );
+		if ( material.defines !== undefined ) {
+
+			keys = Object.keys( material.defines );
+
+			for ( var i = 0; i < keys.length; i ++ ) {
+
+				var d = keys[ i ];
+
+				chunks.push( d );
+				chunks.push( material.defines[ d ] );
+
+			}
 
 		}
 
-		for ( var p in parameters ) {
+		keys = Object.keys( parameters );
+
+		for ( var i = 0; i < keys.length; i ++ ) {
+
+			var p = keys[ i ];
 
 			chunks.push( p );
 			chunks.push( parameters[ p ] );
@@ -22769,8 +22815,11 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		material.uniformsList = [];
 
-		for ( u in material.__webglShader.uniforms ) {
+		keys = Object.keys( material.__webglShader.uniforms );
+
+		for ( var i = 0; i < keys.length; i ++ ) {
 
+			var u = keys[ i ];
 			var location = material.program.uniforms[ u ];
 
 			if ( location ) {
@@ -29124,15 +29173,23 @@ THREE.Animation.prototype.update = (function(){
 
 		var duration = this.data.length;
 
-		if ( this.loop === true && this.currentTime > duration ) {
+		if ( this.currentTime > duration || this.currentTime < 0 ) {
 
-			this.currentTime %= duration;
-			this.reset();
+			if ( this.loop ) {
 
-		} else if ( this.loop === false && this.currentTime > duration ) {
+				this.currentTime %= duration;
 
-			this.stop();
-			return;
+				if ( this.currentTime < 0 )
+					this.currentTime += duration;
+
+				this.reset();
+
+			} else {
+
+				this.stop();
+				return;
+
+			}
 
 		}
 
@@ -29152,7 +29209,8 @@ THREE.Animation.prototype.update = (function(){
 				var prevKey = animationCache.prevKey[ type ];
 				var nextKey = animationCache.nextKey[ type ];
 
-				if ( nextKey.time <= this.currentTime ) {
+				if ( ( this.timeScale > 0 && nextKey.time <= this.currentTime ) ||
+					( this.timeScale < 0 && prevKey.time >= this.currentTime ) ) {
 
 					prevKey = this.data.hierarchy[ h ].keys[ 0 ];
 					nextKey = this.getNextKeyWith( type, h, 1 );

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


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