Explorar el Código

WebGPURenderer: Fix attribute data getting reset when using vec3 in WebGPU (#27708)

Renaud Rohlinger hace 1 año
padre
commit
66ed062bfc
Se han modificado 1 ficheros con 6 adiciones y 0 borrados
  1. 6 0
      examples/jsm/renderers/webgpu/utils/WebGPUAttributeUtils.js

+ 6 - 0
examples/jsm/renderers/webgpu/utils/WebGPUAttributeUtils.js

@@ -49,6 +49,12 @@ class WebGPUAttributeUtils {
 				bufferAttribute.itemSize = 4;
 				array = new array.constructor( bufferAttribute.count * 4 );
 
+				for ( let i = 0; i < bufferAttribute.count; i ++ ) {
+
+					array.set( bufferAttribute.array.subarray( i * 3, i * 3 + 3 ), i * 4 );
+
+				}
+
 			}
 
 			const size = array.byteLength + ( ( 4 - ( array.byteLength % 4 ) ) % 4 ); // ensure 4 byte alignment, see #20441