Sfoglia il codice sorgente

BatchedMesh: Avoid primitive restart values in index array (#28641)

* BatchedMesh: Avoid primitive restart values in index array

* BatchedMesh: Add clarifying comment on primitive restart
Don McCurdy 1 anno fa
parent
commit
376f997ebd
1 ha cambiato i file con 2 aggiunte e 1 eliminazioni
  1. 2 1
      src/objects/BatchedMesh.js

+ 2 - 1
src/objects/BatchedMesh.js

@@ -239,7 +239,8 @@ class BatchedMesh extends Mesh {
 
 
 			if ( reference.getIndex() !== null ) {
 			if ( reference.getIndex() !== null ) {
 
 
-				const indexArray = maxVertexCount > 65536
+				// Reserve last u16 index for primitive restart.
+				const indexArray = maxVertexCount > 65535
 					? new Uint32Array( maxIndexCount )
 					? new Uint32Array( maxIndexCount )
 					: new Uint16Array( maxIndexCount );
 					: new Uint16Array( maxIndexCount );