Zhonghua Xi 10 years ago
parent
commit
2cfc7d258e
1 changed files with 8 additions and 5 deletions
  1. 8 5
      src/core/Geometry.js

+ 8 - 5
src/core/Geometry.js

@@ -225,18 +225,21 @@ THREE.Geometry.prototype = {
 	},
 
 	normalize: function() {
+
+		this.computeBoundingSphere();
+
 		var COM = this.boundingSphere.center;
 		var R = this.boundingSphere.radius;
 
 		var s = (R === 0 ? 1 : 1.0 / R);
 
 		var m = new THREE.Matrix4().set(
-			s, 0, 0, -s*COM.x,
-			0, s, 0, -s*COM.y,
-			0, 0, s, -s*COM.z,
-			0, 0, 0, 1);
+			s, 0, 0, -s * COM.x,
+			0, s, 0, -s * COM.y,
+			0, 0, s, -s * COM.z,
+			0, 0, 0, 1 );
 
-		this.applyMatrix(m);
+		this.applyMatrix( m );
 
 		return this;
 	},