Explorar o código

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 %!s(int64=8) %!d(string=hai) anos
pai
achega
2cde08bc81
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  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 ) {