Procházet zdrojové kódy

Code review changes

Gary Hsu před 7 roky
rodič
revize
93d3bc07f1

+ 8 - 3
src/Materials/Textures/babylon.internalTexture.ts

@@ -356,11 +356,16 @@ module BABYLON {
                     return;
 
                 case InternalTexture.DATASOURCE_CUBERAW:
+                    proxy = this._engine.createRawCubeTexture(this._bufferViewArray!, this.width, this.format, this.type, this.generateMipMaps, this.invertY, this.samplingMode, this._compression);
+                    proxy._swapAndDie(this);
+                    this.isReady = true;
+                    return;
+
                 case InternalTexture.DATASOURCE_CUBERAW_RGBD:
                     proxy = this._engine.createRawCubeTexture(null, this.width, this.format, this.type, this.generateMipMaps, this.invertY, this.samplingMode, this._compression);
-                    if (this._dataSource === InternalTexture.DATASOURCE_CUBERAW_RGBD) {
-                        RawCubeTexture._UpdateRGBDAsync(proxy, this._bufferViewArrayArray!, this._sphericalPolynomial, this._lodGenerationScale, this._lodGenerationOffset);
-                    }
+                    RawCubeTexture._UpdateRGBDAsync(proxy, this._bufferViewArrayArray!, this._sphericalPolynomial, this._lodGenerationScale, this._lodGenerationOffset).then(() => {
+                        this.isReady = true;
+                    });
                     proxy._swapAndDie(this);
                     return;
 

+ 1 - 1
src/Tools/babylon.environmentTextureTools.ts

@@ -406,7 +406,7 @@ module BABYLON {
                         let roughness = 1 - smoothness;
 
                         let minLODIndex = offset; // roughness = 0
-                        let maxLODIndex = (mipmapsCount - 1) * scale + offset; // roughness = 1
+                        let maxLODIndex = (mipmapsCount - 1) * scale + offset; // roughness = 1 (mipmaps start from 0)
 
                         let lodIndex = minLODIndex + (maxLODIndex - minLODIndex) * roughness;
                         let mipmapIndex = Math.round(Math.min(Math.max(lodIndex, 0), maxLODIndex));