2
0
Эх сурвалжийг харах

Merge pull request #11330 from WestLangley/dev-poly

PolyhedronGeometry: Compute flat normals when detail is zero
Mr.doob 8 жил өмнө
parent
commit
bbcc412ca6

+ 10 - 1
src/geometries/PolyhedronGeometry.js

@@ -74,7 +74,16 @@ function PolyhedronBufferGeometry( vertices, indices, radius, detail ) {
 	this.addAttribute( 'position', new Float32BufferAttribute( vertexBuffer, 3 ) );
 	this.addAttribute( 'normal', new Float32BufferAttribute( vertexBuffer.slice(), 3 ) );
 	this.addAttribute( 'uv', new Float32BufferAttribute( uvBuffer, 2 ) );
-	this.normalizeNormals();
+
+	if ( detail === 0 ) {
+
+		this.computeVertexNormals(); // flat normals
+
+	} else {
+
+		this.normalizeNormals(); // smooth normals
+
+	}
 
 	// helper functions