ソースを参照

WebGPURenderer: Fix support for non-indexed BatchedMesh (#30084)

* WebGPURenderer: Fix support for non-indexed BatchedMesh

* simplify code
Renaud Rohlinger 1 年間 前
コミット
0338a81964
1 ファイル変更9 行追加3 行削除
  1. 9 3
      src/renderers/webgpu/WebGPUBackend.js

+ 9 - 3
src/renderers/webgpu/WebGPUBackend.js

@@ -976,14 +976,20 @@ class WebGPUBackend extends Backend {
 			const drawCount = object._multiDrawCount;
 			const drawInstances = object._multiDrawInstances;
 
-			const bytesPerElement = hasIndex ? index.array.BYTES_PER_ELEMENT : 1;
-
 			for ( let i = 0; i < drawCount; i ++ ) {
 
 				const count = drawInstances ? drawInstances[ i ] : 1;
 				const firstInstance = count > 1 ? 0 : i;
 
-				passEncoderGPU.drawIndexed( counts[ i ], count, starts[ i ] / bytesPerElement, 0, firstInstance );
+				if ( hasIndex === true ) {
+
+					passEncoderGPU.drawIndexed( counts[ i ], count, starts[ i ] / index.array.BYTES_PER_ELEMENT, 0, firstInstance );
+
+				} else {
+
+					passEncoderGPU.draw( counts[ i ], count, starts[ i ], firstInstance );
+
+				}
 
 			}
 

粤ICP备19079148号