Browse Source

Canvas2D bug fix for Sprite2D

Only the Texture's URL was used to create the ModelRenderCache which bugs is two textures instances using the same URL were created (and disposed)
nockawa 8 years ago
parent
commit
506fd2330f
1 changed files with 14 additions and 1 deletions
  1. 14 1
      canvas2D/src/Engine/babylon.smartPropertyPrim.ts

+ 14 - 1
canvas2D/src/Engine/babylon.smartPropertyPrim.ts

@@ -1057,7 +1057,20 @@
                         }
                         }
                     }
                     }
 
 
-                    modelKey += v.name + ":" + ((propVal != null) ? ((v.typeLevelCompare) ? Tools.getClassName(propVal) : propVal.toString()) : "[null]") + ";";
+                    let value = "[null]";
+                    if (propVal != null) {
+                        if (v.typeLevelCompare) {
+                            value = Tools.getClassName(propVal);
+                        } else {
+                            if (propVal instanceof BaseTexture) {
+                                value = propVal.uid;
+                            } else {
+                                value = propVal.toString();
+                            }
+                        }
+                    }
+
+                    modelKey += v.name + ":" + value + ";";
                 }
                 }
             });
             });