Browse Source

Update Geometry.js

fixed a bug in mergeVertices, which removes wrong faces.
zexee 12 years ago
parent
commit
41b1a45a63
1 changed files with 4 additions and 3 deletions
  1. 4 3
      src/core/Geometry.js

+ 4 - 3
src/core/Geometry.js

@@ -573,12 +573,13 @@ THREE.Geometry.prototype = {
 		}
 		}
 
 
 		for ( i = faceIndicesToRemove.length - 1; i >= 0; i -- ) {
 		for ( i = faceIndicesToRemove.length - 1; i >= 0; i -- ) {
-
-			this.faces.splice( i, 1 );
+			var idx = faceIndicesToRemove[ i ];
+			
+			this.faces.splice( idx, 1 );
 
 
 			for ( j = 0, jl = this.faceVertexUvs.length; j < jl; j ++ ) {
 			for ( j = 0, jl = this.faceVertexUvs.length; j < jl; j ++ ) {
 
 
-				this.faceVertexUvs[ j ].splice( i, 1 );
+				this.faceVertexUvs[ j ].splice( idx, 1 );
 
 
 			}
 			}