Explorar o código

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 %!s(int64=7) %!d(string=hai) anos
pai
achega
a6c4773c63
Modificáronse 1 ficheiros con 3 adicións e 2 borrados
  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);
                 }