Bläddra i källkod

Fix texture replacement function

David Catuhe 6 år sedan
förälder
incheckning
9f370ed3a9

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1770 - 1760
dist/preview release/babylon.d.ts


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 1
dist/preview release/babylon.js


+ 61 - 39
dist/preview release/babylon.max.js

@@ -31802,6 +31802,16 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        Object.defineProperty(BaseTexture.prototype, "noMipmap", {
+            /**
+             * Are mip maps generated for this texture or not.
+             */
+            get: function () {
+                return false;
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(BaseTexture.prototype, "lodGenerationOffset", {
             /**
              * With prefiltered texture, defined the offset used during the prefiltering steps.
@@ -31973,6 +31983,41 @@ var BABYLON;
             return new BABYLON.Size(this._texture.baseWidth, this._texture.baseHeight);
         };
         /**
+               * Update the sampling mode of the texture.
+               * Default is Trilinear mode.
+               *
+               * | Value | Type               | Description |
+               * | ----- | ------------------ | ----------- |
+               * | 1     | NEAREST_SAMPLINGMODE or NEAREST_NEAREST_MIPLINEAR  | Nearest is: mag = nearest, min = nearest, mip = linear |
+               * | 2     | BILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPNEAREST | Bilinear is: mag = linear, min = linear, mip = nearest |
+               * | 3     | TRILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPLINEAR | Trilinear is: mag = linear, min = linear, mip = linear |
+               * | 4     | NEAREST_NEAREST_MIPNEAREST |             |
+               * | 5    | NEAREST_LINEAR_MIPNEAREST |             |
+               * | 6    | NEAREST_LINEAR_MIPLINEAR |             |
+               * | 7    | NEAREST_LINEAR |             |
+               * | 8    | NEAREST_NEAREST |             |
+               * | 9   | LINEAR_NEAREST_MIPNEAREST |             |
+               * | 10   | LINEAR_NEAREST_MIPLINEAR |             |
+               * | 11   | LINEAR_LINEAR |             |
+               * | 12   | LINEAR_NEAREST |             |
+               *
+               *    > _mag_: magnification filter (close to the viewer)
+               *    > _min_: minification filter (far from the viewer)
+               *    > _mip_: filter used between mip map levels
+               *@param samplingMode Define the new sampling mode of the texture
+               */
+        BaseTexture.prototype.updateSamplingMode = function (samplingMode) {
+            if (!this._texture) {
+                return;
+            }
+            var scene = this.getScene();
+            if (!scene) {
+                return;
+            }
+            this._samplingMode = samplingMode;
+            scene.getEngine().updateTextureSamplingMode(samplingMode, this._texture);
+        };
+        /**
          * Scales the texture if is `canRescale()`
          * @param ratio the resize factor we want to use to rescale
          */
@@ -32532,41 +32577,6 @@ var BABYLON;
             this._delayedOnLoad = null;
             this._delayedOnError = null;
         };
-        /**
-          * Update the sampling mode of the texture.
-         * Default is Trilinear mode.
-         *
-         * | Value | Type               | Description |
-         * | ----- | ------------------ | ----------- |
-         * | 1     | NEAREST_SAMPLINGMODE or NEAREST_NEAREST_MIPLINEAR  | Nearest is: mag = nearest, min = nearest, mip = linear |
-         * | 2     | BILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPNEAREST | Bilinear is: mag = linear, min = linear, mip = nearest |
-         * | 3     | TRILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPLINEAR | Trilinear is: mag = linear, min = linear, mip = linear |
-         * | 4     | NEAREST_NEAREST_MIPNEAREST |             |
-         * | 5    | NEAREST_LINEAR_MIPNEAREST |             |
-         * | 6    | NEAREST_LINEAR_MIPLINEAR |             |
-         * | 7    | NEAREST_LINEAR |             |
-         * | 8    | NEAREST_NEAREST |             |
-         * | 9   | LINEAR_NEAREST_MIPNEAREST |             |
-         * | 10   | LINEAR_NEAREST_MIPLINEAR |             |
-         * | 11   | LINEAR_LINEAR |             |
-         * | 12   | LINEAR_NEAREST |             |
-         *
-         *    > _mag_: magnification filter (close to the viewer)
-         *    > _min_: minification filter (far from the viewer)
-         *    > _mip_: filter used between mip map levels
-         *@param samplingMode Define the new sampling mode of the texture
-         */
-        Texture.prototype.updateSamplingMode = function (samplingMode) {
-            if (!this._texture) {
-                return;
-            }
-            var scene = this.getScene();
-            if (!scene) {
-                return;
-            }
-            this._samplingMode = samplingMode;
-            scene.getEngine().updateTextureSamplingMode(samplingMode, this._texture);
-        };
         Texture.prototype._prepareRowForTextureGeneration = function (x, y, z, t) {
             x *= this.uScale;
             y *= this.vScale;
@@ -73756,6 +73766,16 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        Object.defineProperty(CubeTexture.prototype, "noMipmap", {
+            /**
+             * Are mip maps generated for this texture or not.
+             */
+            get: function () {
+                return this._noMipmap;
+            },
+            enumerable: true,
+            configurable: true
+        });
         /**
          * Creates a cube texture from an array of image urls
          * @param files defines an array of image urls
@@ -73784,9 +73804,10 @@ var BABYLON;
         /**
          * Update the url (and optional buffer) of this texture if url was null during construction.
          * @param url the url of the texture
+         * @param forcedExtension defines the extension to use
          * @param onLoad callback called when the texture is loaded  (defaults to null)
          */
-        CubeTexture.prototype.updateURL = function (url, onLoad) {
+        CubeTexture.prototype.updateURL = function (url, forcedExtension, onLoad) {
             if (this.url) {
                 this.releaseInternalTexture();
             }
@@ -73795,12 +73816,13 @@ var BABYLON;
             if (onLoad) {
                 this._delayedOnLoad = onLoad;
             }
-            this.delayLoad();
+            this.delayLoad(forcedExtension);
         };
         /**
          * Delays loading of the cube texture
+         * @param forcedExtension defines the extension to use
          */
-        CubeTexture.prototype.delayLoad = function () {
+        CubeTexture.prototype.delayLoad = function (forcedExtension) {
             if (this.delayLoadState !== BABYLON.Engine.DELAYLOADSTATE_NOTLOADED) {
                 return;
             }
@@ -73815,7 +73837,7 @@ var BABYLON;
                     this._texture = scene.getEngine().createPrefilteredCubeTexture(this.url, scene, this.lodGenerationScale, this.lodGenerationOffset, this._delayedOnLoad, undefined, this._format, undefined, this._createPolynomials);
                 }
                 else {
-                    this._texture = scene.getEngine().createCubeTexture(this.url, scene, this._files, this._noMipmap, this._delayedOnLoad, undefined, this._format);
+                    this._texture = scene.getEngine().createCubeTexture(this.url, scene, this._files, this._noMipmap, this._delayedOnLoad, undefined, this._format, forcedExtension);
                 }
             }
         };

+ 61 - 39
dist/preview release/babylon.no-module.max.js

@@ -31769,6 +31769,16 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        Object.defineProperty(BaseTexture.prototype, "noMipmap", {
+            /**
+             * Are mip maps generated for this texture or not.
+             */
+            get: function () {
+                return false;
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(BaseTexture.prototype, "lodGenerationOffset", {
             /**
              * With prefiltered texture, defined the offset used during the prefiltering steps.
@@ -31940,6 +31950,41 @@ var BABYLON;
             return new BABYLON.Size(this._texture.baseWidth, this._texture.baseHeight);
         };
         /**
+               * Update the sampling mode of the texture.
+               * Default is Trilinear mode.
+               *
+               * | Value | Type               | Description |
+               * | ----- | ------------------ | ----------- |
+               * | 1     | NEAREST_SAMPLINGMODE or NEAREST_NEAREST_MIPLINEAR  | Nearest is: mag = nearest, min = nearest, mip = linear |
+               * | 2     | BILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPNEAREST | Bilinear is: mag = linear, min = linear, mip = nearest |
+               * | 3     | TRILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPLINEAR | Trilinear is: mag = linear, min = linear, mip = linear |
+               * | 4     | NEAREST_NEAREST_MIPNEAREST |             |
+               * | 5    | NEAREST_LINEAR_MIPNEAREST |             |
+               * | 6    | NEAREST_LINEAR_MIPLINEAR |             |
+               * | 7    | NEAREST_LINEAR |             |
+               * | 8    | NEAREST_NEAREST |             |
+               * | 9   | LINEAR_NEAREST_MIPNEAREST |             |
+               * | 10   | LINEAR_NEAREST_MIPLINEAR |             |
+               * | 11   | LINEAR_LINEAR |             |
+               * | 12   | LINEAR_NEAREST |             |
+               *
+               *    > _mag_: magnification filter (close to the viewer)
+               *    > _min_: minification filter (far from the viewer)
+               *    > _mip_: filter used between mip map levels
+               *@param samplingMode Define the new sampling mode of the texture
+               */
+        BaseTexture.prototype.updateSamplingMode = function (samplingMode) {
+            if (!this._texture) {
+                return;
+            }
+            var scene = this.getScene();
+            if (!scene) {
+                return;
+            }
+            this._samplingMode = samplingMode;
+            scene.getEngine().updateTextureSamplingMode(samplingMode, this._texture);
+        };
+        /**
          * Scales the texture if is `canRescale()`
          * @param ratio the resize factor we want to use to rescale
          */
@@ -32499,41 +32544,6 @@ var BABYLON;
             this._delayedOnLoad = null;
             this._delayedOnError = null;
         };
-        /**
-          * Update the sampling mode of the texture.
-         * Default is Trilinear mode.
-         *
-         * | Value | Type               | Description |
-         * | ----- | ------------------ | ----------- |
-         * | 1     | NEAREST_SAMPLINGMODE or NEAREST_NEAREST_MIPLINEAR  | Nearest is: mag = nearest, min = nearest, mip = linear |
-         * | 2     | BILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPNEAREST | Bilinear is: mag = linear, min = linear, mip = nearest |
-         * | 3     | TRILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPLINEAR | Trilinear is: mag = linear, min = linear, mip = linear |
-         * | 4     | NEAREST_NEAREST_MIPNEAREST |             |
-         * | 5    | NEAREST_LINEAR_MIPNEAREST |             |
-         * | 6    | NEAREST_LINEAR_MIPLINEAR |             |
-         * | 7    | NEAREST_LINEAR |             |
-         * | 8    | NEAREST_NEAREST |             |
-         * | 9   | LINEAR_NEAREST_MIPNEAREST |             |
-         * | 10   | LINEAR_NEAREST_MIPLINEAR |             |
-         * | 11   | LINEAR_LINEAR |             |
-         * | 12   | LINEAR_NEAREST |             |
-         *
-         *    > _mag_: magnification filter (close to the viewer)
-         *    > _min_: minification filter (far from the viewer)
-         *    > _mip_: filter used between mip map levels
-         *@param samplingMode Define the new sampling mode of the texture
-         */
-        Texture.prototype.updateSamplingMode = function (samplingMode) {
-            if (!this._texture) {
-                return;
-            }
-            var scene = this.getScene();
-            if (!scene) {
-                return;
-            }
-            this._samplingMode = samplingMode;
-            scene.getEngine().updateTextureSamplingMode(samplingMode, this._texture);
-        };
         Texture.prototype._prepareRowForTextureGeneration = function (x, y, z, t) {
             x *= this.uScale;
             y *= this.vScale;
@@ -73723,6 +73733,16 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        Object.defineProperty(CubeTexture.prototype, "noMipmap", {
+            /**
+             * Are mip maps generated for this texture or not.
+             */
+            get: function () {
+                return this._noMipmap;
+            },
+            enumerable: true,
+            configurable: true
+        });
         /**
          * Creates a cube texture from an array of image urls
          * @param files defines an array of image urls
@@ -73751,9 +73771,10 @@ var BABYLON;
         /**
          * Update the url (and optional buffer) of this texture if url was null during construction.
          * @param url the url of the texture
+         * @param forcedExtension defines the extension to use
          * @param onLoad callback called when the texture is loaded  (defaults to null)
          */
-        CubeTexture.prototype.updateURL = function (url, onLoad) {
+        CubeTexture.prototype.updateURL = function (url, forcedExtension, onLoad) {
             if (this.url) {
                 this.releaseInternalTexture();
             }
@@ -73762,12 +73783,13 @@ var BABYLON;
             if (onLoad) {
                 this._delayedOnLoad = onLoad;
             }
-            this.delayLoad();
+            this.delayLoad(forcedExtension);
         };
         /**
          * Delays loading of the cube texture
+         * @param forcedExtension defines the extension to use
          */
-        CubeTexture.prototype.delayLoad = function () {
+        CubeTexture.prototype.delayLoad = function (forcedExtension) {
             if (this.delayLoadState !== BABYLON.Engine.DELAYLOADSTATE_NOTLOADED) {
                 return;
             }
@@ -73782,7 +73804,7 @@ var BABYLON;
                     this._texture = scene.getEngine().createPrefilteredCubeTexture(this.url, scene, this.lodGenerationScale, this.lodGenerationOffset, this._delayedOnLoad, undefined, this._format, undefined, this._createPolynomials);
                 }
                 else {
-                    this._texture = scene.getEngine().createCubeTexture(this.url, scene, this._files, this._noMipmap, this._delayedOnLoad, undefined, this._format);
+                    this._texture = scene.getEngine().createCubeTexture(this.url, scene, this._files, this._noMipmap, this._delayedOnLoad, undefined, this._format, forcedExtension);
                 }
             }
         };

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 1
dist/preview release/babylon.worker.js


+ 61 - 39
dist/preview release/es6.js

@@ -31769,6 +31769,16 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        Object.defineProperty(BaseTexture.prototype, "noMipmap", {
+            /**
+             * Are mip maps generated for this texture or not.
+             */
+            get: function () {
+                return false;
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(BaseTexture.prototype, "lodGenerationOffset", {
             /**
              * With prefiltered texture, defined the offset used during the prefiltering steps.
@@ -31940,6 +31950,41 @@ var BABYLON;
             return new BABYLON.Size(this._texture.baseWidth, this._texture.baseHeight);
         };
         /**
+               * Update the sampling mode of the texture.
+               * Default is Trilinear mode.
+               *
+               * | Value | Type               | Description |
+               * | ----- | ------------------ | ----------- |
+               * | 1     | NEAREST_SAMPLINGMODE or NEAREST_NEAREST_MIPLINEAR  | Nearest is: mag = nearest, min = nearest, mip = linear |
+               * | 2     | BILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPNEAREST | Bilinear is: mag = linear, min = linear, mip = nearest |
+               * | 3     | TRILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPLINEAR | Trilinear is: mag = linear, min = linear, mip = linear |
+               * | 4     | NEAREST_NEAREST_MIPNEAREST |             |
+               * | 5    | NEAREST_LINEAR_MIPNEAREST |             |
+               * | 6    | NEAREST_LINEAR_MIPLINEAR |             |
+               * | 7    | NEAREST_LINEAR |             |
+               * | 8    | NEAREST_NEAREST |             |
+               * | 9   | LINEAR_NEAREST_MIPNEAREST |             |
+               * | 10   | LINEAR_NEAREST_MIPLINEAR |             |
+               * | 11   | LINEAR_LINEAR |             |
+               * | 12   | LINEAR_NEAREST |             |
+               *
+               *    > _mag_: magnification filter (close to the viewer)
+               *    > _min_: minification filter (far from the viewer)
+               *    > _mip_: filter used between mip map levels
+               *@param samplingMode Define the new sampling mode of the texture
+               */
+        BaseTexture.prototype.updateSamplingMode = function (samplingMode) {
+            if (!this._texture) {
+                return;
+            }
+            var scene = this.getScene();
+            if (!scene) {
+                return;
+            }
+            this._samplingMode = samplingMode;
+            scene.getEngine().updateTextureSamplingMode(samplingMode, this._texture);
+        };
+        /**
          * Scales the texture if is `canRescale()`
          * @param ratio the resize factor we want to use to rescale
          */
@@ -32499,41 +32544,6 @@ var BABYLON;
             this._delayedOnLoad = null;
             this._delayedOnError = null;
         };
-        /**
-          * Update the sampling mode of the texture.
-         * Default is Trilinear mode.
-         *
-         * | Value | Type               | Description |
-         * | ----- | ------------------ | ----------- |
-         * | 1     | NEAREST_SAMPLINGMODE or NEAREST_NEAREST_MIPLINEAR  | Nearest is: mag = nearest, min = nearest, mip = linear |
-         * | 2     | BILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPNEAREST | Bilinear is: mag = linear, min = linear, mip = nearest |
-         * | 3     | TRILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPLINEAR | Trilinear is: mag = linear, min = linear, mip = linear |
-         * | 4     | NEAREST_NEAREST_MIPNEAREST |             |
-         * | 5    | NEAREST_LINEAR_MIPNEAREST |             |
-         * | 6    | NEAREST_LINEAR_MIPLINEAR |             |
-         * | 7    | NEAREST_LINEAR |             |
-         * | 8    | NEAREST_NEAREST |             |
-         * | 9   | LINEAR_NEAREST_MIPNEAREST |             |
-         * | 10   | LINEAR_NEAREST_MIPLINEAR |             |
-         * | 11   | LINEAR_LINEAR |             |
-         * | 12   | LINEAR_NEAREST |             |
-         *
-         *    > _mag_: magnification filter (close to the viewer)
-         *    > _min_: minification filter (far from the viewer)
-         *    > _mip_: filter used between mip map levels
-         *@param samplingMode Define the new sampling mode of the texture
-         */
-        Texture.prototype.updateSamplingMode = function (samplingMode) {
-            if (!this._texture) {
-                return;
-            }
-            var scene = this.getScene();
-            if (!scene) {
-                return;
-            }
-            this._samplingMode = samplingMode;
-            scene.getEngine().updateTextureSamplingMode(samplingMode, this._texture);
-        };
         Texture.prototype._prepareRowForTextureGeneration = function (x, y, z, t) {
             x *= this.uScale;
             y *= this.vScale;
@@ -73723,6 +73733,16 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        Object.defineProperty(CubeTexture.prototype, "noMipmap", {
+            /**
+             * Are mip maps generated for this texture or not.
+             */
+            get: function () {
+                return this._noMipmap;
+            },
+            enumerable: true,
+            configurable: true
+        });
         /**
          * Creates a cube texture from an array of image urls
          * @param files defines an array of image urls
@@ -73751,9 +73771,10 @@ var BABYLON;
         /**
          * Update the url (and optional buffer) of this texture if url was null during construction.
          * @param url the url of the texture
+         * @param forcedExtension defines the extension to use
          * @param onLoad callback called when the texture is loaded  (defaults to null)
          */
-        CubeTexture.prototype.updateURL = function (url, onLoad) {
+        CubeTexture.prototype.updateURL = function (url, forcedExtension, onLoad) {
             if (this.url) {
                 this.releaseInternalTexture();
             }
@@ -73762,12 +73783,13 @@ var BABYLON;
             if (onLoad) {
                 this._delayedOnLoad = onLoad;
             }
-            this.delayLoad();
+            this.delayLoad(forcedExtension);
         };
         /**
          * Delays loading of the cube texture
+         * @param forcedExtension defines the extension to use
          */
-        CubeTexture.prototype.delayLoad = function () {
+        CubeTexture.prototype.delayLoad = function (forcedExtension) {
             if (this.delayLoadState !== BABYLON.Engine.DELAYLOADSTATE_NOTLOADED) {
                 return;
             }
@@ -73782,7 +73804,7 @@ var BABYLON;
                     this._texture = scene.getEngine().createPrefilteredCubeTexture(this.url, scene, this.lodGenerationScale, this.lodGenerationOffset, this._delayedOnLoad, undefined, this._format, undefined, this._createPolynomials);
                 }
                 else {
-                    this._texture = scene.getEngine().createCubeTexture(this.url, scene, this._files, this._noMipmap, this._delayedOnLoad, undefined, this._format);
+                    this._texture = scene.getEngine().createCubeTexture(this.url, scene, this._files, this._noMipmap, this._delayedOnLoad, undefined, this._format, forcedExtension);
                 }
             }
         };

+ 3 - 1
inspector/src/components/actionTabs/lines/fileButtonLineComponent.tsx

@@ -16,6 +16,8 @@ export class FileButtonLineComponent extends React.Component<IFileButtonLineComp
         if (files && files.length) {
             this.props.onClick(files[0]);
         }
+
+        evt.target.value = "";
     }
 
     render() {
@@ -24,7 +26,7 @@ export class FileButtonLineComponent extends React.Component<IFileButtonLineComp
                 <label htmlFor="file-upload" className="file-upload">
                     {this.props.label}
                 </label>
-                <input id="file-upload" type="file" accept={this.props.accept} onChange={evt => this.onChange(evt)} />
+                <input ref="upload" id="file-upload" type="file" accept={this.props.accept} onChange={evt => this.onChange(evt)} />
             </div>
         );
     }

+ 3 - 3
inspector/src/components/actionTabs/lines/textureLineComponent.tsx

@@ -1,8 +1,8 @@
 import * as React from "react";
-import { Texture, PostProcess } from "babylonjs";
+import { BaseTexture, PostProcess, Texture } from "babylonjs";
 
 interface ITextureLineComponentProps {
-    texture: Texture,
+    texture: BaseTexture,
     width: number,
     height: number
 }
@@ -108,7 +108,7 @@ export class TextureLineComponent extends React.Component<ITextureLineComponentP
             }
 
             //To flip image on Y axis.
-            if (texture.invertY || texture.isCube) {
+            if ((texture as Texture).invertY || texture.isCube) {
                 for (var i = 0; i < halfHeight; i++) {
                     for (var j = 0; j < numberOfChannelsByLine; j++) {
                         var currentCell = j + i * numberOfChannelsByLine;

+ 13 - 5
inspector/src/components/actionTabs/tabs/propertyGrids/materials/texturePropertyGridComponent.tsx

@@ -1,5 +1,5 @@
 import * as React from "react";
-import { Texture, CubeTexture, Observable } from "babylonjs";
+import { Texture, BaseTexture, CubeTexture, Observable } from "babylonjs";
 import { PropertyChangedEvent } from "../../../../propertyChangedEvent";
 import { LineContainerComponent } from "../../../lineContainerComponent";
 import { SliderLineComponent } from "../../../lines/sliderLineComponent";
@@ -10,9 +10,10 @@ import { FloatLineComponent } from "../../../lines/floatLineComponent";
 import { AdvancedDynamicTexture } from "babylonjs-gui";
 import { OptionsLineComponent } from "../../../lines/optionsLineComponent";
 import { FileButtonLineComponent } from "../../../lines/fileButtonLineComponent";
+import { text } from "@fortawesome/fontawesome-svg-core";
 
 interface ITexturePropertyGridComponentProps {
-    texture: Texture,
+    texture: BaseTexture,
     onPropertyChangedObservable?: Observable<PropertyChangedEvent>
 }
 
@@ -28,9 +29,16 @@ export class TexturePropertyGridComponent extends React.Component<ITextureProper
             var url = URL.createObjectURL(blob);
 
             if (texture.isCube) {
-                (texture as CubeTexture).updateURL(url, () => this.forceUpdate());
+                let extension: string | undefined = undefined;
+                if (file.name.toLowerCase().indexOf(".dds") > 0) {
+                    extension = ".dds";
+                } else if (file.name.toLowerCase().indexOf(".env") > 0) {
+                    extension = ".env";
+                }
+
+                (texture as CubeTexture).updateURL(url, extension, () => this.forceUpdate());
             } else {
-                texture.updateURL(url, null, () => this.forceUpdate());
+                (texture as Texture).updateURL(url, null, () => this.forceUpdate());
             }
 
         }, undefined, true);
@@ -50,7 +58,7 @@ export class TexturePropertyGridComponent extends React.Component<ITextureProper
             <div className="pane">
                 <LineContainerComponent title="PREVIEW">
                     <TextureLineComponent texture={texture} width={256} height={256} />
-                    <FileButtonLineComponent label="Replace texture" onClick={(file) => this.updateTexture(file)} accept=".jpg, .png, .tga" />
+                    <FileButtonLineComponent label="Replace texture" onClick={(file) => this.updateTexture(file)} accept=".jpg, .png, .tga, .dds, .env" />
                 </LineContainerComponent>
                 <LineContainerComponent title="GENERAL">
                     <TextLineComponent label="Has alpha" value={texture.hasAlpha ? "Yes" : "No"} />

+ 49 - 0
src/Materials/Textures/babylon.baseTexture.ts

@@ -172,6 +172,13 @@ module BABYLON {
         public invertZ = false;
 
         /**
+         * Are mip maps generated for this texture or not.
+         */
+        public get noMipmap(): boolean {
+            return false;
+        }
+
+        /**
          * @hidden
          */
         @serialize()
@@ -265,6 +272,9 @@ module BABYLON {
         private _scene: Nullable<Scene>;
 
         /** @hidden */
+        public _samplingMode: number;
+
+        /** @hidden */
         public _texture: Nullable<InternalTexture>;
         private _uid: Nullable<string>;
 
@@ -389,6 +399,45 @@ module BABYLON {
             return new Size(this._texture.baseWidth, this._texture.baseHeight);
         }
 
+  /**
+         * Update the sampling mode of the texture.
+         * Default is Trilinear mode.
+         *
+         * | Value | Type               | Description |
+         * | ----- | ------------------ | ----------- |
+         * | 1     | NEAREST_SAMPLINGMODE or NEAREST_NEAREST_MIPLINEAR  | Nearest is: mag = nearest, min = nearest, mip = linear |
+         * | 2     | BILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPNEAREST | Bilinear is: mag = linear, min = linear, mip = nearest |
+         * | 3     | TRILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPLINEAR | Trilinear is: mag = linear, min = linear, mip = linear |
+         * | 4     | NEAREST_NEAREST_MIPNEAREST |             |
+         * | 5    | NEAREST_LINEAR_MIPNEAREST |             |
+         * | 6    | NEAREST_LINEAR_MIPLINEAR |             |
+         * | 7    | NEAREST_LINEAR |             |
+         * | 8    | NEAREST_NEAREST |             |
+         * | 9   | LINEAR_NEAREST_MIPNEAREST |             |
+         * | 10   | LINEAR_NEAREST_MIPLINEAR |             |
+         * | 11   | LINEAR_LINEAR |             |
+         * | 12   | LINEAR_NEAREST |             |
+         *
+         *    > _mag_: magnification filter (close to the viewer)
+         *    > _min_: minification filter (far from the viewer)
+         *    > _mip_: filter used between mip map levels
+         *@param samplingMode Define the new sampling mode of the texture
+         */
+        public updateSamplingMode(samplingMode: number): void {
+            if (!this._texture) {
+                return;
+            }
+
+            let scene = this.getScene();
+
+            if (!scene) {
+                return;
+            }
+
+            this._samplingMode = samplingMode;
+            scene.getEngine().updateTextureSamplingMode(samplingMode, this._texture);
+        }
+
         /**
          * Scales the texture if is `canRescale()`
          * @param ratio the resize factor we want to use to rescale

+ 16 - 6
src/Materials/Textures/babylon.cubeTexture.ts

@@ -60,6 +60,13 @@ module BABYLON {
             return this._rotationY;
         }
 
+        /**
+         * Are mip maps generated for this texture or not.
+         */
+        public get noMipmap(): boolean {
+            return this._noMipmap;
+        }
+
         private _noMipmap: boolean;
         private _files: string[];
         private _extensions: string[];
@@ -68,7 +75,7 @@ module BABYLON {
         private _createPolynomials: boolean;
 
         /** @hidden */
-        public readonly _prefiltered: boolean = false;
+        public _prefiltered: boolean = false;
 
         /**
          * Creates a cube texture from an array of image urls
@@ -194,27 +201,30 @@ module BABYLON {
         /**
          * Update the url (and optional buffer) of this texture if url was null during construction.
          * @param url the url of the texture
+         * @param forcedExtension defines the extension to use
          * @param onLoad callback called when the texture is loaded  (defaults to null)
          */
-        public updateURL(url: string, onLoad?: () => void): void {
+        public updateURL(url: string, forcedExtension?: string, onLoad?: () => void): void {
             if (this.url) {
-                this.releaseInternalTexture();
+                this.releaseInternalTexture();                
             }
 
             this.url = url;
             this.delayLoadState = Engine.DELAYLOADSTATE_NOTLOADED;
+            this._prefiltered = false;
 
             if (onLoad) {
                 this._delayedOnLoad = onLoad;
             }
 
-            this.delayLoad();
+            this.delayLoad(forcedExtension);
         }
 
         /**
          * Delays loading of the cube texture
+         * @param forcedExtension defines the extension to use
          */
-        public delayLoad(): void {
+        public delayLoad(forcedExtension?: string): void {
             if (this.delayLoadState !== Engine.DELAYLOADSTATE_NOTLOADED) {
                 return;
             }
@@ -232,7 +242,7 @@ module BABYLON {
                     this._texture = scene.getEngine().createPrefilteredCubeTexture(this.url, scene, this.lodGenerationScale, this.lodGenerationOffset, this._delayedOnLoad, undefined, this._format, undefined, this._createPolynomials);
                 }
                 else {
-                    this._texture = scene.getEngine().createCubeTexture(this.url, scene, this._files, this._noMipmap, this._delayedOnLoad, undefined, this._format);
+                    this._texture = scene.getEngine().createCubeTexture(this.url, scene, this._files, this._noMipmap, this._delayedOnLoad, undefined, this._format, forcedExtension);
                 }
             }
         }

+ 1 - 42
src/Materials/Textures/babylon.texture.ts

@@ -170,8 +170,7 @@ module BABYLON {
         private _cachedWAng: number;
         private _cachedProjectionMatrixId: number;
         private _cachedCoordinatesMode: number;
-        /** @hidden */
-        public _samplingMode: number;
+
         /** @hidden */
         public _buffer: Nullable<string | ArrayBuffer | HTMLImageElement | Blob>;
         private _deleteBuffer: boolean;
@@ -307,7 +306,6 @@ module BABYLON {
             if (onLoad) {
                 this._delayedOnLoad = onLoad;
             }
-
             this.delayLoad();
         }
 
@@ -348,45 +346,6 @@ module BABYLON {
             this._delayedOnError = null;
         }
 
-        /**
-          * Update the sampling mode of the texture.
-         * Default is Trilinear mode.
-         *
-         * | Value | Type               | Description |
-         * | ----- | ------------------ | ----------- |
-         * | 1     | NEAREST_SAMPLINGMODE or NEAREST_NEAREST_MIPLINEAR  | Nearest is: mag = nearest, min = nearest, mip = linear |
-         * | 2     | BILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPNEAREST | Bilinear is: mag = linear, min = linear, mip = nearest |
-         * | 3     | TRILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPLINEAR | Trilinear is: mag = linear, min = linear, mip = linear |
-         * | 4     | NEAREST_NEAREST_MIPNEAREST |             |
-         * | 5    | NEAREST_LINEAR_MIPNEAREST |             |
-         * | 6    | NEAREST_LINEAR_MIPLINEAR |             |
-         * | 7    | NEAREST_LINEAR |             |
-         * | 8    | NEAREST_NEAREST |             |
-         * | 9   | LINEAR_NEAREST_MIPNEAREST |             |
-         * | 10   | LINEAR_NEAREST_MIPLINEAR |             |
-         * | 11   | LINEAR_LINEAR |             |
-         * | 12   | LINEAR_NEAREST |             |
-         *
-         *    > _mag_: magnification filter (close to the viewer)
-         *    > _min_: minification filter (far from the viewer)
-         *    > _mip_: filter used between mip map levels
-         *@param samplingMode Define the new sampling mode of the texture
-         */
-        public updateSamplingMode(samplingMode: number): void {
-            if (!this._texture) {
-                return;
-            }
-
-            let scene = this.getScene();
-
-            if (!scene) {
-                return;
-            }
-
-            this._samplingMode = samplingMode;
-            scene.getEngine().updateTextureSamplingMode(samplingMode, this._texture);
-        }
-
         private _prepareRowForTextureGeneration(x: number, y: number, z: number, t: Vector3): void {
             x *= this.uScale;
             y *= this.vScale;