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 years ago
parent
commit
a6c4773c63
1 changed files with 3 additions and 2 deletions
  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
             // determine if a ktx file should be substituted
             var isKTX = false;
             var isKTX = false;
-            if (this._textureFormatInUse && !isBase64 && !fallback) {
+            if (this._textureFormatInUse && !isBase64 && !fallback && !buffer) {
                 url = url.substring(0, lastDot) + this._textureFormatInUse;
                 url = url.substring(0, lastDot) + this._textureFormatInUse;
                 isKTX = true;
                 isKTX = true;
             }
             }
@@ -4201,7 +4201,8 @@
                     scene._removePendingData(texture);
                     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);
                     texture.onLoadedObservable.remove(onLoadObserver);
                 }
                 }