Преглед изворни кода

Move gammaSpace to InternalTexture

Popov72 пре 5 година
родитељ
комит
cf06f43e48
2 измењених фајлова са 18 додато и 3 уклоњено
  1. 15 3
      src/Materials/Textures/baseTexture.ts
  2. 3 0
      src/Materials/Textures/internalTexture.ts

+ 15 - 3
src/Materials/Textures/baseTexture.ts

@@ -1,4 +1,4 @@
-import { serialize, SerializationHelper, serializeAsTexture, expandToProperty } from "../../Misc/decorators";
+import { serialize, SerializationHelper, serializeAsTexture } from "../../Misc/decorators";
 import { Observer, Observable } from "../../Misc/observable";
 import { Nullable } from "../../types";
 import { Scene } from "../../scene";
@@ -239,8 +239,20 @@ export class BaseTexture implements IAnimatable {
      * This only impacts the PBR and Background materials
      */
     @serialize()
-    @expandToProperty("_markAllSubMeshesAsTexturesDirty")
-    public gammaSpace = true;
+    public get gammaSpace(): boolean {
+        return this._texture?._gammaSpace ?? true;
+    }
+
+    public set gammaSpace(gamma: boolean) {
+        if ((this._texture?._gammaSpace ?? gamma) === gamma) {
+            return;
+        }
+
+        if (this._texture) {
+            this._texture._gammaSpace = gamma;
+            this._markAllSubMeshesAsTexturesDirty();
+        }
+    }
 
     /**
      * Gets or sets whether or not the texture contains RGBD data.

+ 3 - 0
src/Materials/Textures/internalTexture.ts

@@ -253,6 +253,9 @@ export class InternalTexture {
     /** @hidden */
     public _references: number = 1;
 
+    /** @hidden */
+    public _gammaSpace = true;
+
     private _engine: ThinEngine;
 
     /**