浏览代码

Fix DDS Upload Issue

Sebastien Vandenberghe 7 年之前
父节点
当前提交
9c27f7a372
共有 2 个文件被更改,包括 6 次插入2 次删除
  1. 5 1
      src/Engine/babylon.engine.ts
  2. 1 1
      src/Materials/Textures/Loaders/babylon.ddsTextureLoader.ts

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

@@ -5413,6 +5413,10 @@
                     let mipmapIndex = Math.round(Math.min(Math.max(lodIndex, 0), maxLODIndex));
 
                     var glTextureFromLod = new InternalTexture(this, InternalTexture.DATASOURCE_TEMP);
+                    glTextureFromLod.type = texture.type;
+                    glTextureFromLod.format = texture.format;
+                    glTextureFromLod.width = Math.pow(2, Math.max( Scalar.Log2(width) - mipmapIndex, 0));
+                    glTextureFromLod.height = glTextureFromLod.width;
                     glTextureFromLod.isCube = true;
                     this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, glTextureFromLod, true);
 
@@ -5426,7 +5430,7 @@
                         var data: any = loadData.data;
                         this._unpackFlipY(info.isCompressed);
 
-                        DDSTools.UploadDDSLevels(this, texture, data, info, true, 6, mipmapIndex);
+                        DDSTools.UploadDDSLevels(this, glTextureFromLod, data, info, true, 6, mipmapIndex);
                     }
                     else {
                         Tools.Warn("DDS is the only prefiltered cube map supported so far.")

+ 1 - 1
src/Materials/Textures/Loaders/babylon.ddsTextureLoader.ts

@@ -97,7 +97,7 @@ module BABYLON {
             texture.isReady = true;
 
             if (onLoad) {
-                onLoad({ isDDS: true, width: texture.width, info, imgs, texture });
+                onLoad({ isDDS: true, width: texture.width, info, data: imgs, texture });
             }
         }