diff --git a/src/extras/geometries/PolyhedronGeometry.js b/src/extras/geometries/PolyhedronGeometry.js index 6b437f826628dc8c7d8e90c91e03e9085c0e374d..a8ee08177a5bb853edd2013820930d240ab656d3 100644 --- a/src/extras/geometries/PolyhedronGeometry.js +++ b/src/extras/geometries/PolyhedronGeometry.js @@ -63,11 +63,6 @@ THREE.PolyhedronGeometry = function ( vertices, faces, radius, detail ) { } - // Merge vertices - - this.mergeVertices(); - - // Apply radius for ( var i = 0, l = this.vertices.length; i < l; i ++ ) { @@ -77,6 +72,17 @@ THREE.PolyhedronGeometry = function ( vertices, faces, radius, detail ) { } + // Merge vertices + + this.mergeVertices(); + + this.computeCentroids(); + + this.computeFaceNormals(); + + this.boundingSphere = new THREE.Sphere( new THREE.Vector3(), radius ); + + // Project vector onto sphere's surface function prepare( vector ) { @@ -101,7 +107,6 @@ THREE.PolyhedronGeometry = function ( vertices, faces, radius, detail ) { var face = new THREE.Face3( v1.index, v2.index, v3.index, [ v1.clone(), v2.clone(), v3.clone() ] ); face.centroid.add( v1 ).add( v2 ).add( v3 ).divideScalar( 3 ); - face.normal.copy( face.centroid ).normalize(); that.faces.push( face ); var azi = azimuth( face.centroid ); @@ -213,9 +218,6 @@ THREE.PolyhedronGeometry = function ( vertices, faces, radius, detail ) { } - this.computeCentroids(); - - this.boundingSphere = new THREE.Sphere( new THREE.Vector3(), radius ); };