Преглед на файлове

Merge pull request #1836 from wyklion/master

1. bug when only have skin fallback. 2. bug when clone fallbacked skin mesh
David Catuhe преди 8 години
родител
ревизия
066cac9dc5
променени са 2 файла, в които са добавени 10 реда и са изтрити 4 реда
  1. 7 3
      src/Materials/babylon.effect.ts
  2. 3 1
      src/Mesh/babylon.geometry.ts

+ 7 - 3
src/Materials/babylon.effect.ts

@@ -28,6 +28,9 @@
             this._meshRank = rank;
             this._mesh = mesh;
 
+            if (rank < this._currentRank) {
+                this._currentRank = rank;
+            }
             if (rank > this._maxRank) {
                 this._maxRank = rank;
             }
@@ -40,9 +43,10 @@
         public reduce(currentDefines: string): string {
 
             var currentFallbacks = this._defines[this._currentRank];
-
-            for (var index = 0; index < currentFallbacks.length; index++) {
-                currentDefines = currentDefines.replace("#define " + currentFallbacks[index], "");
+            if (currentFallbacks) {
+                for (var index = 0; index < currentFallbacks.length; index++) {
+                    currentDefines = currentDefines.replace("#define " + currentFallbacks[index], "");
+                }
             }
 
             if (this._mesh && this._currentRank === this._meshRank) {

+ 3 - 1
src/Mesh/babylon.geometry.ts

@@ -401,7 +401,9 @@
                 if (numOfMeshes === 1) {
                     this._vertexBuffers[kind].create();
                 }
-                this._vertexBuffers[kind].getBuffer().references = numOfMeshes;
+                var buffer = this._vertexBuffers[kind].getBuffer();
+                if (buffer)
+                    buffer.references = numOfMeshes;
 
                 if (kind === VertexBuffer.PositionKind) {
                     mesh._resetPointsArrayCache();