浏览代码

1.) Added check in CreateTexture to disallow use of compressed Texture when a buffer is passed. This allows use of Texture.CreateFromBase64String while compressed textures are enabled.
2.) Added isKTX check before removing LoadObserver when error is due to unavailability of .ktx format image. This allows fallback to run the onLoad.

kalpesh.awathare 7 年之前
父节点
当前提交
a6c4773c63
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      src/Engine/babylon.engine.ts

+ 3 - 2
src/Engine/babylon.engine.ts

@@ -4171,7 +4171,7 @@
 
             // determine if a ktx file should be substituted
             var isKTX = false;
-            if (this._textureFormatInUse && !isBase64 && !fallback) {
+            if (this._textureFormatInUse && !isBase64 && !fallback && !buffer) {
                 url = url.substring(0, lastDot) + this._textureFormatInUse;
                 isKTX = true;
             }
@@ -4201,7 +4201,8 @@
                     scene._removePendingData(texture);
                 }
 
-                if (onLoadObserver) {
+                if (onLoadObserver && !isKTX) {
+                    //dont remove the observer if its a ktx file, since the fallback createTexture call will require it.
                     texture.onLoadedObservable.remove(onLoadObserver);
                 }