David Catuhe 6 years ago
parent
commit
a8b1a0964b
2 changed files with 10 additions and 2 deletions
  1. 1 1
      src/Materials/materialHelper.ts
  2. 9 1
      src/Meshes/mesh.ts

+ 1 - 1
src/Materials/materialHelper.ts

@@ -593,7 +593,7 @@ export class MaterialHelper {
                 }
 
                 if (uv) {
-                    attribs.push(VertexBuffer.UVKind + index);
+                    attribs.push(VertexBuffer.UVKind + "_" + index);
                 }
 
                 if (attribs.length > maxAttributesCount) {

+ 9 - 1
src/Meshes/mesh.ts

@@ -2686,7 +2686,7 @@ export class Mesh extends AbstractMesh implements IGetSetVerticesData {
                 vertex_data.uvs = uvs;
             }
             if (currentColors !== null && currentColors !== void 0) {
-             vertex_data.colors = colors;
+                vertex_data.colors = colors;
             }
 
             vertex_data.applyToMesh(this, this.isVertexBufferUpdatable(VertexBuffer.PositionKind));
@@ -2970,6 +2970,11 @@ export class Mesh extends AbstractMesh implements IGetSetVerticesData {
                 if (tangents) {
                     this.geometry.setVerticesData(VertexBuffer.TangentKind + index, tangents, false, 3);
                 }
+
+                const uvs = morphTarget.getUVs();
+                if (uvs) {
+                    this.geometry.setVerticesData(VertexBuffer.UVKind + "_" + index, uvs, false, 2);
+                }
             }
         } else {
             var index = 0;
@@ -2984,6 +2989,9 @@ export class Mesh extends AbstractMesh implements IGetSetVerticesData {
                 if (this.geometry.isVerticesDataPresent(VertexBuffer.TangentKind + index)) {
                     this.geometry.removeVerticesData(VertexBuffer.TangentKind + index);
                 }
+                if (this.geometry.isVerticesDataPresent(VertexBuffer.UVKind + index)) {
+                    this.geometry.removeVerticesData(VertexBuffer.UVKind + "_" + index);
+                }
                 index++;
             }
         }