Selaa lähdekoodia

WebGPURenderer: Fix strip index format (#27279)

sunag 1 vuosi sitten
vanhempi
commit
84424e4f2e
1 muutettua tiedostoa jossa 2 lisäystä ja 3 poistoa
  1. 2 3
      examples/jsm/renderers/webgpu/utils/WebGPUPipelineUtils.js

+ 2 - 3
examples/jsm/renderers/webgpu/utils/WebGPUPipelineUtils.js

@@ -456,10 +456,9 @@ class WebGPUPipelineUtils {
 
 		descriptor.topology = utils.getPrimitiveTopology( object, material );
 
-		if ( object.isLine === true && object.isLineSegments !== true ) {
+		if ( geometry.index !== null && object.isLine === true && object.isLineSegments !== true ) {
 
-			const count = ( geometry.index ) ? geometry.index.count : geometry.attributes.position.count;
-			descriptor.stripIndexFormat = ( count > 65535 ) ? GPUIndexFormat.Uint32 : GPUIndexFormat.Uint16; // define data type for primitive restart value
+			descriptor.stripIndexFormat = ( geometry.index.array instanceof Uint16Array ) ? GPUIndexFormat.Uint16 : GPUIndexFormat.Uint32;
 
 		}