Browse Source

BufferGeometry.computeBoundingBox() / Box3.setFromArray() clean up.

Mr.doob 9 years ago
parent
commit
fdc1793498
2 changed files with 3 additions and 7 deletions
  1. 2 4
      src/core/BufferGeometry.js
  2. 1 3
      src/math/Box3.js

+ 2 - 4
src/core/BufferGeometry.js

@@ -560,13 +560,11 @@ THREE.BufferGeometry.prototype = {
 
 		var positions = this.attributes.position.array;
 
-		if ( positions ) {
+		if ( positions !== undefined ) {
 
 			this.boundingBox.setFromArray( positions );
 
-		}
-
-		if ( positions === undefined || positions.length === 0 ) {
+		} else {
 
 			this.boundingBox.makeEmpty();
 

+ 1 - 3
src/math/Box3.js

@@ -25,8 +25,6 @@ THREE.Box3.prototype = {
 
 	setFromArray: function ( array ) {
 
-		this.makeEmpty();
-
 		var minX = + Infinity;
 		var minY = + Infinity;
 		var minZ = + Infinity;
@@ -35,7 +33,7 @@ THREE.Box3.prototype = {
 		var maxY = - Infinity;
 		var maxZ = - Infinity;
 
-		for ( var i = 0, il = array.length; i < il; i += 3 ) {
+		for ( var i = 0, l = array.length; i < l; i += 3 ) {
 
 			var x = array[ i ];
 			var y = array[ i + 1 ];