瀏覽代碼

Fix DDS load Warning.

sebavan 5 年之前
父節點
當前提交
792dc456bb
共有 3 個文件被更改,包括 9 次插入5 次删除
  1. 2 1
      .vscode/settings.json
  2. 5 2
      src/Engines/engine.ts
  3. 2 2
      src/Materials/Textures/Loaders/ddsTextureLoader.ts

+ 2 - 1
.vscode/settings.json

@@ -53,7 +53,8 @@
         "**/*.fragment.ts": true,
         "**/*.vertex.ts": true,
         "**/ShadersInclude/**/*.ts": true,
-        "assets": true
+        "assets": true,
+        "**/babylonWeb**": true,
     },
     "editor.tabSize": 4,
     "typescript.tsdk": "node_modules\\typescript\\lib",

+ 5 - 2
src/Engines/engine.ts

@@ -668,13 +668,16 @@ export class Engine extends ThinEngine {
     /**
      * Force the mipmap generation for the given render target texture
      * @param texture defines the render target texture to use
+     * @param unbind defines whether or not to unbind the texture after generation. Defaults to true.
      */
-    public generateMipMapsForCubemap(texture: InternalTexture) {
+    public generateMipMapsForCubemap(texture: InternalTexture, unbind = true) {
         if (texture.generateMipMaps) {
             var gl = this._gl;
             this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);
             gl.generateMipmap(gl.TEXTURE_CUBE_MAP);
-            this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);
+            if (unbind) {
+                this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);
+            }
         }
     }
 

+ 2 - 2
src/Materials/Textures/Loaders/ddsTextureLoader.ts

@@ -96,10 +96,10 @@ export class _DDSTextureLoader implements IInternalTextureLoader {
             DDSTools.UploadDDSLevels(engine, texture, data, info, loadMipmap, 6);
 
             if (!info.isFourCC && info.mipmapCount === 1) {
-                engine.generateMipMapsForCubemap(texture);
+                // Do not unbind as we still need to set the parameters.
+                engine.generateMipMapsForCubemap(texture, false);
             }
         }
-
         engine._setCubeMapTextureParams(loadMipmap);
         texture.isReady = true;
         texture.onLoadedObservable.notifyObservers(texture);