浏览代码

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 年之前
父节点
当前提交
2cde08bc81
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      src/math/Sphere.js

+ 3 - 1
src/math/Sphere.js

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