Browse Source

BufferGeometry: Got bounding* to work again.

Mr.doob 10 years ago
parent
commit
bd422a4f3e
1 changed files with 3 additions and 3 deletions
  1. 3 3
      src/core/BufferGeometry.js

+ 3 - 3
src/core/BufferGeometry.js

@@ -473,7 +473,7 @@ THREE.BufferGeometry.prototype = {
 				var bb = this.boundingBox;
 				var bb = this.boundingBox;
 				bb.makeEmpty();
 				bb.makeEmpty();
 
 
-				for ( var i = 0, il = positions.length; i < il; i ++ ) {
+				for ( var i = 0, il = positions.length; i < il; i += 3 ) {
 
 
 					vector.fromArray( positions, i );
 					vector.fromArray( positions, i );
 					bb.expandByPoint( vector );
 					bb.expandByPoint( vector );
@@ -520,7 +520,7 @@ THREE.BufferGeometry.prototype = {
 
 
 				var center = this.boundingSphere.center;
 				var center = this.boundingSphere.center;
 
 
-				for ( var i = 0, il = positions.length; i < il; i ++ ) {
+				for ( var i = 0, il = positions.length; i < il; i += 3 ) {
 
 
 					vector.fromArray( positions, i );
 					vector.fromArray( positions, i );
 					box.expandByPoint( vector );
 					box.expandByPoint( vector );
@@ -534,7 +534,7 @@ THREE.BufferGeometry.prototype = {
 
 
 				var maxRadiusSq = 0;
 				var maxRadiusSq = 0;
 
 
-				for ( var i = 0, il = positions.length; i < il; i ++ ) {
+				for ( var i = 0, il = positions.length; i < il; i += 3 ) {
 
 
 					vector.fromArray( positions, i );
 					vector.fromArray( positions, i );
 					maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( vector ) );
 					maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( vector ) );