Jelajahi Sumber

WebGPURenderer - Disable Draw Call when object.count = 0 (#30881)

* init branch

* clamp to 0 if object.count is negative

* dissolve
Christian Helgeson 11 bulan lalu
induk
melakukan
d0d0e1d860
1 mengubah file dengan 14 tambahan dan 1 penghapusan
  1. 14 1
      src/renderers/common/RenderObject.js

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

@@ -509,7 +509,20 @@ class RenderObject {
 
 		const index = this.getIndex();
 		const hasIndex = ( index !== null );
-		const instanceCount = geometry.isInstancedBufferGeometry ? geometry.instanceCount : ( object.count > 1 ? object.count : 1 );
+
+		let instanceCount = 1;
+
+		if ( geometry.isInstancedBufferGeometry === true ) {
+
+			instanceCount = geometry.instanceCount;
+
+		} else if ( object.count !== undefined ) {
+
+			instanceCount = Math.max( 0, object.count );
+
+		}
+
+		//const instanceCount = geometry.isInstancedBufferGeometry ? geometry.instanceCount : ( object.count !== undefined ? Math.max( 0, object.count ) : 1 );
 
 		if ( instanceCount === 0 ) return null;
 

粤ICP备19079148号