Mr.doob 2 недель назад
Родитель
Сommit
34c4e010fd

+ 39 - 13
build/three.cjs

@@ -27094,7 +27094,19 @@ class BatchedMesh extends Mesh {
 		// the indexed version of the multi draw function requires specifying the start
 		// the indexed version of the multi draw function requires specifying the start
 		// offset in bytes.
 		// offset in bytes.
 		const index = geometry.getIndex();
 		const index = geometry.getIndex();
-		const bytesPerElement = index === null ? 1 : index.array.BYTES_PER_ELEMENT;
+		let bytesPerElement = index === null ? 1 : index.array.BYTES_PER_ELEMENT;
+
+
+		// the "wireframe" attribute implicitly creates a line attribute in the renderer, which is double
+		// the vertices to draw (3 lines per triangle) so we multiply the draw counts / starts and make
+		// assumptions about the index buffer byte size.
+		let multiDrawMultiplier = 1;
+		if ( material.wireframe ) {
+
+			multiDrawMultiplier = 2;
+			bytesPerElement = geometry.attributes.position.count > 65535 ? 4 : 2;
+
+		}
 
 
 		const instanceInfo = this._instanceInfo;
 		const instanceInfo = this._instanceInfo;
 		const multiDrawStarts = this._multiDrawStarts;
 		const multiDrawStarts = this._multiDrawStarts;
@@ -27175,8 +27187,8 @@ class BatchedMesh extends Mesh {
 			for ( let i = 0, l = list.length; i < l; i ++ ) {
 			for ( let i = 0, l = list.length; i < l; i ++ ) {
 
 
 				const item = list[ i ];
 				const item = list[ i ];
-				multiDrawStarts[ multiDrawCount ] = item.start * bytesPerElement;
-				multiDrawCounts[ multiDrawCount ] = item.count;
+				multiDrawStarts[ multiDrawCount ] = item.start * bytesPerElement * multiDrawMultiplier;
+				multiDrawCounts[ multiDrawCount ] = item.count * multiDrawMultiplier;
 				indirectArray[ multiDrawCount ] = item.index;
 				indirectArray[ multiDrawCount ] = item.index;
 				multiDrawCount ++;
 				multiDrawCount ++;
 
 
@@ -27206,8 +27218,8 @@ class BatchedMesh extends Mesh {
 					if ( ! culled ) {
 					if ( ! culled ) {
 
 
 						const geometryInfo = geometryInfoList[ geometryId ];
 						const geometryInfo = geometryInfoList[ geometryId ];
-						multiDrawStarts[ multiDrawCount ] = geometryInfo.start * bytesPerElement;
-						multiDrawCounts[ multiDrawCount ] = geometryInfo.count;
+						multiDrawStarts[ multiDrawCount ] = geometryInfo.start * bytesPerElement * multiDrawMultiplier;
+						multiDrawCounts[ multiDrawCount ] = geometryInfo.count * multiDrawMultiplier;
 						indirectArray[ multiDrawCount ] = i;
 						indirectArray[ multiDrawCount ] = i;
 						multiDrawCount ++;
 						multiDrawCount ++;
 
 
@@ -43798,7 +43810,7 @@ class FileLoader extends Loader {
 
 
 		/**
 		/**
 		 * The expected mime type. Valid values can be found
 		 * The expected mime type. Valid values can be found
-		 * [here](hhttps://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString#mimetype)
+		 * [here](https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString#mimetype)
 		 *
 		 *
 		 * @type {string}
 		 * @type {string}
 		 */
 		 */
@@ -48087,7 +48099,17 @@ class ObjectLoader extends Loader {
 
 
 		const text = await loader.loadAsync( url, onProgress );
 		const text = await loader.loadAsync( url, onProgress );
 
 
-		const json = JSON.parse( text );
+		let json;
+
+		try {
+
+			json = JSON.parse( text );
+
+		} catch ( e ) {
+
+			throw new Error( 'ObjectLoader: Can\'t parse ' + url + '. ' + e.message );
+
+		}
 
 
 		const metadata = json.metadata;
 		const metadata = json.metadata;
 
 
@@ -63705,6 +63727,12 @@ function WebGLGeometries( gl, attributes, info, bindingStates ) {
 		const geometryPosition = geometry.attributes.position;
 		const geometryPosition = geometry.attributes.position;
 		let version = 0;
 		let version = 0;
 
 
+		if ( geometryPosition === undefined ) {
+
+			return;
+
+		}
+
 		if ( geometryIndex !== null ) {
 		if ( geometryIndex !== null ) {
 
 
 			const array = geometryIndex.array;
 			const array = geometryIndex.array;
@@ -63720,7 +63748,7 @@ function WebGLGeometries( gl, attributes, info, bindingStates ) {
 
 
 			}
 			}
 
 
-		} else if ( geometryPosition !== undefined ) {
+		} else {
 
 
 			const array = geometryPosition.array;
 			const array = geometryPosition.array;
 			version = geometryPosition.version;
 			version = geometryPosition.version;
@@ -63735,13 +63763,11 @@ function WebGLGeometries( gl, attributes, info, bindingStates ) {
 
 
 			}
 			}
 
 
-		} else {
-
-			return;
-
 		}
 		}
 
 
-		const attribute = new ( arrayNeedsUint32( indices ) ? Uint32BufferAttribute : Uint16BufferAttribute )( indices, 1 );
+		// check whether a 32 bit or 16 bit buffer is required to store the indices
+		// account for PRIMITIVE_RESTART_FIXED_INDEX, #24565
+		const attribute = new ( geometryPosition.count >= 65535 ? Uint32BufferAttribute : Uint16BufferAttribute )( indices, 1 );
 		attribute.version = version;
 		attribute.version = version;
 
 
 		// Updating index buffer in VAO now. See WebGLBindingStates
 		// Updating index buffer in VAO now. See WebGLBindingStates

Разница между файлами не показана из-за своего большого размера
+ 29 - 7
build/three.core.js


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
build/three.core.min.js


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
build/three.module.js


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
build/three.module.min.js


Разница между файлами не показана из-за своего большого размера
+ 0 - 1
build/three.tsl.js


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
build/three.tsl.min.js


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
build/three.webgpu.js


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
build/three.webgpu.min.js


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
build/three.webgpu.nodes.js


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
build/three.webgpu.nodes.min.js


Некоторые файлы не были показаны из-за большого количества измененных файлов

粤ICP备19079148号