Browse Source

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 năm trước cách đây
mục cha
commit
a6c4773c63
1 tập tin đã thay đổi với 3 bổ sung2 xóa
  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);
                 }