From 69747cb4245fdfb00d88ca2c14d237af8a39a359 Mon Sep 17 00:00:00 2001 From: WestLangley Date: Fri, 24 Jun 2016 16:34:39 -0400 Subject: [PATCH] Use flat vertex normals --- examples/js/geometries/ConvexGeometry.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/examples/js/geometries/ConvexGeometry.js b/examples/js/geometries/ConvexGeometry.js index 062bb652134ee7..cb4e9427f591b3 100644 --- a/examples/js/geometries/ConvexGeometry.js +++ b/examples/js/geometries/ConvexGeometry.js @@ -194,7 +194,18 @@ THREE.ConvexGeometry = function( vertices ) { } this.computeFaceNormals(); - this.computeVertexNormals(); + + // Compute flat vertex normals + for ( var i = 0; i < this.faces.length; i ++ ) { + + var face = this.faces[ i ]; + var normal = face.normal; + + face.vertexNormals[ 0 ] = normal.clone(); + face.vertexNormals[ 1 ] = normal.clone(); + face.vertexNormals[ 2 ] = normal.clone(); + + } };