Browse Source

Updated builds.

Mr.doob 3 năm trước cách đây
mục cha
commit
4ac51a630b
4 tập tin đã thay đổi với 134 bổ sung74 xóa
  1. 42 24
      build/three.cjs
  2. 42 24
      build/three.js
  3. 0 0
      build/three.min.js
  4. 50 26
      build/three.module.js

+ 42 - 24
build/three.cjs

@@ -10939,8 +10939,8 @@ function WebGLBindingStates(gl, extensions, attributes, capabilities) {
 				bindVertexArrayObject(currentState.object);
 			}
 
-			updateBuffers = needsUpdate(geometry, index);
-			if (updateBuffers) saveCache(geometry, index);
+			updateBuffers = needsUpdate(object, geometry, program, index);
+			if (updateBuffers) saveCache(object, geometry, program, index);
 		} else {
 			const wireframe = material.wireframe === true;
 
@@ -10952,10 +10952,6 @@ function WebGLBindingStates(gl, extensions, attributes, capabilities) {
 			}
 		}
 
-		if (object.isInstancedMesh === true) {
-			updateBuffers = true;
-		}
-
 		if (index !== null) {
 			attributes.update(index, gl.ELEMENT_ARRAY_BUFFER);
 		}
@@ -11036,18 +11032,29 @@ function WebGLBindingStates(gl, extensions, attributes, capabilities) {
 		};
 	}
 
-	function needsUpdate(geometry, index) {
+	function needsUpdate(object, geometry, program, index) {
 		const cachedAttributes = currentState.attributes;
 		const geometryAttributes = geometry.attributes;
 		let attributesNum = 0;
+		const programAttributes = program.getAttributes();
+
+		for (const name in programAttributes) {
+			const programAttribute = programAttributes[name];
+
+			if (programAttribute.location >= 0) {
+				const cachedAttribute = cachedAttributes[name];
+				let geometryAttribute = geometryAttributes[name];
+
+				if (geometryAttribute === undefined) {
+					if (name === 'instanceMatrix' && object.instanceMatrix) geometryAttribute = object.instanceMatrix;
+					if (name === 'instanceColor' && object.instanceColor) geometryAttribute = object.instanceColor;
+				}
 
-		for (const key in geometryAttributes) {
-			const cachedAttribute = cachedAttributes[key];
-			const geometryAttribute = geometryAttributes[key];
-			if (cachedAttribute === undefined) return true;
-			if (cachedAttribute.attribute !== geometryAttribute) return true;
-			if (cachedAttribute.data !== geometryAttribute.data) return true;
-			attributesNum++;
+				if (cachedAttribute === undefined) return true;
+				if (cachedAttribute.attribute !== geometryAttribute) return true;
+				if (geometryAttribute && cachedAttribute.data !== geometryAttribute.data) return true;
+				attributesNum++;
+			}
 		}
 
 		if (currentState.attributesNum !== attributesNum) return true;
@@ -11055,22 +11062,33 @@ function WebGLBindingStates(gl, extensions, attributes, capabilities) {
 		return false;
 	}
 
-	function saveCache(geometry, index) {
+	function saveCache(object, geometry, program, index) {
 		const cache = {};
 		const attributes = geometry.attributes;
 		let attributesNum = 0;
+		const programAttributes = program.getAttributes();
 
-		for (const key in attributes) {
-			const attribute = attributes[key];
-			const data = {};
-			data.attribute = attribute;
+		for (const name in programAttributes) {
+			const programAttribute = programAttributes[name];
 
-			if (attribute.data) {
-				data.data = attribute.data;
-			}
+			if (programAttribute.location >= 0) {
+				let attribute = attributes[name];
+
+				if (attribute === undefined) {
+					if (name === 'instanceMatrix' && object.instanceMatrix) attribute = object.instanceMatrix;
+					if (name === 'instanceColor' && object.instanceColor) attribute = object.instanceColor;
+				}
+
+				const data = {};
+				data.attribute = attribute;
 
-			cache[key] = data;
-			attributesNum++;
+				if (attribute && attribute.data) {
+					data.data = attribute.data;
+				}
+
+				cache[name] = data;
+				attributesNum++;
+			}
 		}
 
 		currentState.attributes = cache;

+ 42 - 24
build/three.js

@@ -10941,8 +10941,8 @@
 					bindVertexArrayObject(currentState.object);
 				}
 
-				updateBuffers = needsUpdate(geometry, index);
-				if (updateBuffers) saveCache(geometry, index);
+				updateBuffers = needsUpdate(object, geometry, program, index);
+				if (updateBuffers) saveCache(object, geometry, program, index);
 			} else {
 				const wireframe = material.wireframe === true;
 
@@ -10954,10 +10954,6 @@
 				}
 			}
 
-			if (object.isInstancedMesh === true) {
-				updateBuffers = true;
-			}
-
 			if (index !== null) {
 				attributes.update(index, gl.ELEMENT_ARRAY_BUFFER);
 			}
@@ -11038,18 +11034,29 @@
 			};
 		}
 
-		function needsUpdate(geometry, index) {
+		function needsUpdate(object, geometry, program, index) {
 			const cachedAttributes = currentState.attributes;
 			const geometryAttributes = geometry.attributes;
 			let attributesNum = 0;
+			const programAttributes = program.getAttributes();
+
+			for (const name in programAttributes) {
+				const programAttribute = programAttributes[name];
+
+				if (programAttribute.location >= 0) {
+					const cachedAttribute = cachedAttributes[name];
+					let geometryAttribute = geometryAttributes[name];
+
+					if (geometryAttribute === undefined) {
+						if (name === 'instanceMatrix' && object.instanceMatrix) geometryAttribute = object.instanceMatrix;
+						if (name === 'instanceColor' && object.instanceColor) geometryAttribute = object.instanceColor;
+					}
 
-			for (const key in geometryAttributes) {
-				const cachedAttribute = cachedAttributes[key];
-				const geometryAttribute = geometryAttributes[key];
-				if (cachedAttribute === undefined) return true;
-				if (cachedAttribute.attribute !== geometryAttribute) return true;
-				if (cachedAttribute.data !== geometryAttribute.data) return true;
-				attributesNum++;
+					if (cachedAttribute === undefined) return true;
+					if (cachedAttribute.attribute !== geometryAttribute) return true;
+					if (geometryAttribute && cachedAttribute.data !== geometryAttribute.data) return true;
+					attributesNum++;
+				}
 			}
 
 			if (currentState.attributesNum !== attributesNum) return true;
@@ -11057,22 +11064,33 @@
 			return false;
 		}
 
-		function saveCache(geometry, index) {
+		function saveCache(object, geometry, program, index) {
 			const cache = {};
 			const attributes = geometry.attributes;
 			let attributesNum = 0;
+			const programAttributes = program.getAttributes();
 
-			for (const key in attributes) {
-				const attribute = attributes[key];
-				const data = {};
-				data.attribute = attribute;
+			for (const name in programAttributes) {
+				const programAttribute = programAttributes[name];
 
-				if (attribute.data) {
-					data.data = attribute.data;
-				}
+				if (programAttribute.location >= 0) {
+					let attribute = attributes[name];
+
+					if (attribute === undefined) {
+						if (name === 'instanceMatrix' && object.instanceMatrix) attribute = object.instanceMatrix;
+						if (name === 'instanceColor' && object.instanceColor) attribute = object.instanceColor;
+					}
+
+					const data = {};
+					data.attribute = attribute;
 
-				cache[key] = data;
-				attributesNum++;
+					if (attribute && attribute.data) {
+						data.data = attribute.data;
+					}
+
+					cache[name] = data;
+					attributesNum++;
+				}
 			}
 
 			currentState.attributes = cache;

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
build/three.min.js


+ 50 - 26
build/three.module.js

@@ -14197,9 +14197,9 @@ function WebGLBindingStates( gl, extensions, attributes, capabilities ) {
 
 			}
 
-			updateBuffers = needsUpdate( geometry, index );
+			updateBuffers = needsUpdate( object, geometry, program, index );
 
-			if ( updateBuffers ) saveCache( geometry, index );
+			if ( updateBuffers ) saveCache( object, geometry, program, index );
 
 		} else {
 
@@ -14219,12 +14219,6 @@ function WebGLBindingStates( gl, extensions, attributes, capabilities ) {
 
 		}
 
-		if ( object.isInstancedMesh === true ) {
-
-			updateBuffers = true;
-
-		}
-
 		if ( index !== null ) {
 
 			attributes.update( index, 34963 );
@@ -14338,25 +14332,40 @@ function WebGLBindingStates( gl, extensions, attributes, capabilities ) {
 
 	}
 
-	function needsUpdate( geometry, index ) {
+	function needsUpdate( object, geometry, program, index ) {
 
 		const cachedAttributes = currentState.attributes;
 		const geometryAttributes = geometry.attributes;
 
 		let attributesNum = 0;
 
-		for ( const key in geometryAttributes ) {
+		const programAttributes = program.getAttributes();
+
+		for ( const name in programAttributes ) {
+
+			const programAttribute = programAttributes[ name ];
+
+			if ( programAttribute.location >= 0 ) {
+
+				const cachedAttribute = cachedAttributes[ name ];
+				let geometryAttribute = geometryAttributes[ name ];
+
+				if ( geometryAttribute === undefined ) {
+
+					if ( name === 'instanceMatrix' && object.instanceMatrix ) geometryAttribute = object.instanceMatrix;
+					if ( name === 'instanceColor' && object.instanceColor ) geometryAttribute = object.instanceColor;
+
+				}
 
-			const cachedAttribute = cachedAttributes[ key ];
-			const geometryAttribute = geometryAttributes[ key ];
+				if ( cachedAttribute === undefined ) return true;
 
-			if ( cachedAttribute === undefined ) return true;
+				if ( cachedAttribute.attribute !== geometryAttribute ) return true;
 
-			if ( cachedAttribute.attribute !== geometryAttribute ) return true;
+				if ( geometryAttribute && cachedAttribute.data !== geometryAttribute.data ) return true;
 
-			if ( cachedAttribute.data !== geometryAttribute.data ) return true;
+				attributesNum ++;
 
-			attributesNum ++;
+			}
 
 		}
 
@@ -14368,28 +14377,43 @@ function WebGLBindingStates( gl, extensions, attributes, capabilities ) {
 
 	}
 
-	function saveCache( geometry, index ) {
+	function saveCache( object, geometry, program, index ) {
 
 		const cache = {};
 		const attributes = geometry.attributes;
 		let attributesNum = 0;
 
-		for ( const key in attributes ) {
+		const programAttributes = program.getAttributes();
 
-			const attribute = attributes[ key ];
+		for ( const name in programAttributes ) {
 
-			const data = {};
-			data.attribute = attribute;
+			const programAttribute = programAttributes[ name ];
 
-			if ( attribute.data ) {
+			if ( programAttribute.location >= 0 ) {
 
-				data.data = attribute.data;
+				let attribute = attributes[ name ];
 
-			}
+				if ( attribute === undefined ) {
 
-			cache[ key ] = data;
+					if ( name === 'instanceMatrix' && object.instanceMatrix ) attribute = object.instanceMatrix;
+					if ( name === 'instanceColor' && object.instanceColor ) attribute = object.instanceColor;
 
-			attributesNum ++;
+				}
+
+				const data = {};
+				data.attribute = attribute;
+
+				if ( attribute && attribute.data ) {
+
+					data.data = attribute.data;
+
+				}
+
+				cache[ name ] = data;
+
+				attributesNum ++;
+
+			}
 
 		}
 

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác