Browse Source

Allow lazy loading of the Box3 constructor, so that webpack can load three js source files directly instead of requiring all of the THREE.

Charles Covey-Brandt 8 years ago
parent
commit
2cde08bc81
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/math/Sphere.js

+ 3 - 1
src/math/Sphere.js

@@ -28,10 +28,12 @@ Sphere.prototype = {
 
 	setFromPoints: function () {
 
-		var box = new Box3();
+		var box;
 
 		return function setFromPoints( points, optionalCenter ) {
 
+			box = box || new Box3();
+
 			var center = this.center;
 
 			if ( optionalCenter !== undefined ) {