From 0037b38357bdc75ccbaf11fe3d5d20492eb3dbb8 Mon Sep 17 00:00:00 2001 From: Thomas FORGIONE Date: Thu, 9 Apr 2015 17:07:07 +0200 Subject: [PATCH] Smooth shading during streaming (oh yes baby) --- js/ProgressiveSphere.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/js/ProgressiveSphere.js b/js/ProgressiveSphere.js index f1fd78a..0ed4b97 100644 --- a/js/ProgressiveSphere.js +++ b/js/ProgressiveSphere.js @@ -57,10 +57,16 @@ ProgessiveSphere.prototype.addFace = function() { )); // Add the new face - this.geometry.faces.push(new THREE.Face3(this.current_face, this.current_face+1, this.current_face+2)); + this.geometry.faces.push(new THREE.Face3( + this.geometry.vertices.length-3, + this.geometry.vertices.length-2, + this.geometry.vertices.length-1 + )); // Update the stuff + this.geometry.mergeVertices(); this.geometry.computeFaceNormals(); + this.geometry.computeVertexNormals(); this.current_face += 3; this.geometry.elementsNeedUpdate = true; this.geometry.normalsNeedUpdate = true;