Sfoglia il codice sorgente

Fix for #2175

- When a Face4 have duplicated vertices,
Geometry.mergeVertices() converts it into a Face3
- Face3 now copies normal, color, materialIndex, vertexColors
from the original Face4
zz85 13 anni fa
parent
commit
5b07ee341a
1 ha cambiato i file con 3 aggiunte e 1 eliminazioni
  1. 3 1
      src/core/Geometry.js

+ 3 - 1
src/core/Geometry.js

@@ -624,11 +624,13 @@ THREE.Geometry.prototype = {
 					if ( o.indexOf(face[abcd[k]]) != k ) {
 						// console.log('faces', face.a, face.b, face.c, face.d, 'dup at', k);
 						o.splice(k, 1);
-						this.faces[ i ] = new THREE.Face3(o[0], o[1], o[2]);
+						this.faces[ i ] = new THREE.Face3(o[0], o[1], o[2], face.normal, face.color, face.materialIndex);
 						for (j=0,jl=this.faceVertexUvs.length;j<jl;j++) {
 							u = this.faceVertexUvs[j][i];
 							if (u) u.splice(k, 1);
 						}
+
+						this.faces[ i ].vertexColors = face.vertexColors;
 						
 						break;
 					}