Selaa lähdekoodia

load multiple dds when files === 6

Ben Adams 7 vuotta sitten
vanhempi
commit
edab7033f6
2 muutettua tiedostoa jossa 6 lisäystä ja 3 poistoa
  1. 1 1
      src/Engine/babylon.engine.ts
  2. 5 2
      src/Materials/Textures/babylon.cubeTexture.ts

+ 1 - 1
src/Engine/babylon.engine.ts

@@ -3955,7 +3955,7 @@
                     texture.isReady = true;
                 }, undefined, undefined, true, onerror);
             } else if (isDDS) {
-                if (files) {
+                if (files && files.length === 6) {
                     cascadeLoadFiles(rootUrl,
                         scene,
                         imgs => {

+ 5 - 2
src/Materials/Textures/babylon.cubeTexture.ts

@@ -40,8 +40,11 @@
 
             this._texture = this._getFromCache(rootUrl, noMipmap);
 
-            if (!files) {
+            const lastDot = rootUrl.lastIndexOf(".");
+            const extension = forcedExtension ? forcedExtension : (lastDot > -1 ? rootUrl.substring(lastDot).toLowerCase() : "");
+            const isDDS = (extension === ".dds");
 
+            if (!isDDS && !files) {
                 if (!extensions) {
                     extensions = ["_px.jpg", "_py.jpg", "_pz.jpg", "_nx.jpg", "_ny.jpg", "_nz.jpg"];
                 }
@@ -55,7 +58,7 @@
                 this._extensions = extensions;
             }
 
-            this._files = files;
+            this._files = files ? files : [];
 
             if (!this._texture) {
                 if (!scene.useDelayedTextureLoading) {