Przeglądaj źródła

Merge pull request #17012 from Mugen87/dev36

Geometry: Honor second set of uvs in .merge().
Mr.doob 6 lat temu
rodzic
commit
4e14ab7a99
1 zmienionych plików z 11 dodań i 11 usunięć
  1. 11 11
      src/core/Geometry.js

+ 11 - 11
src/core/Geometry.js

@@ -695,8 +695,6 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 			vertices2 = geometry.vertices,
 			vertices2 = geometry.vertices,
 			faces1 = this.faces,
 			faces1 = this.faces,
 			faces2 = geometry.faces,
 			faces2 = geometry.faces,
-			uvs1 = this.faceVertexUvs[ 0 ],
-			uvs2 = geometry.faceVertexUvs[ 0 ],
 			colors1 = this.colors,
 			colors1 = this.colors,
 			colors2 = geometry.colors;
 			colors2 = geometry.colors;
 
 
@@ -778,23 +776,25 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 
 
 		// uvs
 		// uvs
 
 
-		for ( i = 0, il = uvs2.length; i < il; i ++ ) {
+		for ( var i = 0, il = geometry.faceVertexUvs.length; i < il; i ++ ) {
 
 
-			var uv = uvs2[ i ], uvCopy = [];
+			var faceVertexUvs2 = geometry.faceVertexUvs[ i ];
 
 
-			if ( uv === undefined ) {
+			if ( this.faceVertexUvs[ i ] === undefined ) this.faceVertexUvs[ i ] = [];
 
 
-				continue;
+			for ( var j = 0, jl = faceVertexUvs2.length; j < jl; j ++ ) {
 
 
-			}
+				var uvs2 = faceVertexUvs2[ j ], uvsCopy = [];
 
 
-			for ( var j = 0, jl = uv.length; j < jl; j ++ ) {
+				for ( var k = 0, kl = uvs2.length; k < kl; k ++ ) {
 
 
-				uvCopy.push( uv[ j ].clone() );
+					uvsCopy.push( uvs2[ k ].clone() );
 
 
-			}
+				}
 
 
-			uvs1.push( uvCopy );
+				this.faceVertexUvs[ i ].push( uvsCopy );
+
+			}
 
 
 		}
 		}