From cd71783f755a3c2f79e496a0a874a0c2cc522d0b Mon Sep 17 00:00:00 2001 From: WestLangley Date: Sat, 13 May 2017 18:21:56 -0400 Subject: [PATCH] Compute flat normals when detail is zero --- src/geometries/PolyhedronGeometry.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/geometries/PolyhedronGeometry.js b/src/geometries/PolyhedronGeometry.js index 03b6a8b8a0..d294654c08 100644 --- a/src/geometries/PolyhedronGeometry.js +++ b/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 ) { + + BufferGeometry.prototype.computeVertexNormals.call( this ); // flat normals + + } else { + + this.normalizeNormals(); // smooth normals + + } // helper functions -- GitLab