Pārlūkot izejas kodu

Fix Prefiltered UpdateURL

sebavan 5 gadi atpakaļ
vecāks
revīzija
32484240a2
1 mainītis faili ar 8 papildinājumiem un 3 dzēšanām
  1. 8 3
      src/Materials/Textures/cubeTexture.ts

+ 8 - 3
src/Materials/Textures/cubeTexture.ts

@@ -253,8 +253,9 @@ export class CubeTexture extends BaseTexture {
      * @param url the url of the texture
      * @param url the url of the texture
      * @param forcedExtension defines the extension to use
      * @param forcedExtension defines the extension to use
      * @param onLoad callback called when the texture is loaded  (defaults to null)
      * @param onLoad callback called when the texture is loaded  (defaults to null)
+     * @param prefiltered Defines whether the updated texture is prefiltered or not
      */
      */
-    public updateURL(url: string, forcedExtension?: string, onLoad?: () => void): void {
+    public updateURL(url: string, forcedExtension?: string, onLoad?: () => void, prefiltered: boolean = false): void {
         if (this.url) {
         if (this.url) {
             this.releaseInternalTexture();
             this.releaseInternalTexture();
             this.getScene()!.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);
             this.getScene()!.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);
@@ -265,7 +266,11 @@ export class CubeTexture extends BaseTexture {
         }
         }
         this.url = url;
         this.url = url;
         this.delayLoadState = Constants.DELAYLOADSTATE_NOTLOADED;
         this.delayLoadState = Constants.DELAYLOADSTATE_NOTLOADED;
-        this._prefiltered = false;
+        this._prefiltered = prefiltered;
+        if (this._prefiltered) {
+            this.gammaSpace = false;
+            this.anisotropicFilteringLevel = 1;
+        }
         this._forcedExtension = forcedExtension || null;
         this._forcedExtension = forcedExtension || null;
 
 
         if (onLoad) {
         if (onLoad) {
@@ -294,7 +299,7 @@ export class CubeTexture extends BaseTexture {
 
 
         if (!this._texture) {
         if (!this._texture) {
             if (this._prefiltered) {
             if (this._prefiltered) {
-                this._texture = scene.getEngine().createPrefilteredCubeTexture(this.url, scene, this.lodGenerationScale, this.lodGenerationOffset, this._delayedOnLoad, undefined, this._format, undefined, this._createPolynomials);
+                this._texture = scene.getEngine().createPrefilteredCubeTexture(this.url, scene, 0.8, 0, this._delayedOnLoad, undefined, this._format, undefined, this._createPolynomials);
             }
             }
             else {
             else {
                 this._texture = scene.getEngine().createCubeTexture(this.url, scene, this._files, this._noMipmap, this._delayedOnLoad, null, this._format, forcedExtension);
                 this._texture = scene.getEngine().createCubeTexture(this.url, scene, this._files, this._noMipmap, this._delayedOnLoad, null, this._format, forcedExtension);