Selaa lähdekoodia

Geometry: compute area-weighted normals by default

WestLangley 9 vuotta sitten
vanhempi
commit
12ea602070
1 muutettua tiedostoa jossa 8 lisäystä ja 0 poistoa
  1. 8 0
      src/core/Geometry.js

+ 8 - 0
src/core/Geometry.js

@@ -399,6 +399,8 @@ THREE.Geometry.prototype = {
 
 	computeVertexNormals: function ( areaWeighted ) {
 
+		if ( areaWeighted === undefined ) areaWeighted = true;
+
 		var v, vl, f, fl, face, vertices;
 
 		vertices = new Array( this.vertices.length );
@@ -477,6 +479,12 @@ THREE.Geometry.prototype = {
 
 		}
 
+		if ( this.faces.length > 0 ) {
+
+			this.normalsNeedUpdate = true;
+
+		}
+
 	},
 
 	computeMorphNormals: function () {