Browse Source

CylinderGeometry: Don't add degenerate triangles (#29460)

* CylinderGeometry: Don't add degenerate triangles

* Change comparison
Garrett Johnson 1 year ago
parent
commit
ae67bfdfc0
1 changed files with 11 additions and 4 deletions
  1. 11 4
      src/geometries/CylinderGeometry.js

+ 11 - 4
src/geometries/CylinderGeometry.js

@@ -133,12 +133,19 @@ class CylinderGeometry extends BufferGeometry {
 
 					// faces
 
-					indices.push( a, b, d );
-					indices.push( b, c, d );
+					if ( radiusTop > 0 ) {
 
-					// update group counter
+						indices.push( a, b, d );
+						groupCount += 3;
 
-					groupCount += 6;
+					}
+
+					if ( radiusBottom > 0 ) {
+
+						indices.push( b, c, d );
+						groupCount += 3;
+
+					}
 
 				}
 

粤ICP备19079148号