Explorar o código

Fix VertexData serialization from SPS mesh

Do not set vertex data if empty array in SPS's buildMesh(), otherwise it would break serialization if a SPS is built without any UVs for example.
Alexandre Carvallo %!s(int64=7) %!d(string=hai) anos
pai
achega
8f42193f7a
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      src/Particles/babylon.solidParticleSystem.ts

+ 2 - 2
src/Particles/babylon.solidParticleSystem.ts

@@ -200,10 +200,10 @@
                 vertexData.indices = (this._depthSort) ? this._indices : this._indices32;
                 vertexData.set(this._positions32, VertexBuffer.PositionKind);
                 vertexData.set(this._normals32, VertexBuffer.NormalKind);
-                if (this._uvs32) {
+                if (this._uvs32.length > 0) {
                     vertexData.set(this._uvs32, VertexBuffer.UVKind);;
                 }
-                if (this._colors32) {
+                if (this._colors32.length > 0) {
                     vertexData.set(this._colors32, VertexBuffer.ColorKind);
                 }
                 var mesh = new Mesh(this.name, this._scene);