Преглед на файлове

WebGPURenderer: Add support for geometry without attributes (#29576)

Renaud Rohlinger преди 1 година
родител
ревизия
0c7cf78a64
променени са 1 файла, в които са добавени 12 реда и са изтрити 1 реда
  1. 12 1
      src/renderers/common/RenderObject.js

+ 12 - 1
src/renderers/common/RenderObject.js

@@ -233,7 +233,18 @@ export default class RenderObject {
 
 		}
 
-		const itemCount = hasIndex === true ? index.count : geometry.attributes.position.count;
+		const position = geometry.attributes.position;
+		let itemCount = Infinity;
+
+		if ( hasIndex ) {
+
+			itemCount = index.count;
+
+		} else if ( position !== undefined && position !== null ) {
+
+			itemCount = position.count;
+
+		}
 
 		firstVertex = Math.max( firstVertex, 0 );
 		lastVertex = Math.min( lastVertex, itemCount );

粤ICP备19079148号