From 94bf5538928d653dcf411bd21eef64c4c312b2cd Mon Sep 17 00:00:00 2001 From: Catalin Moldovan Date: Wed, 29 May 2024 09:07:15 +0300 Subject: [PATCH] Texture property changes flags --- src/platform/graphics/texture.js | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/src/platform/graphics/texture.js b/src/platform/graphics/texture.js index 5b41b854a29..81a3d0470ac 100644 --- a/src/platform/graphics/texture.js +++ b/src/platform/graphics/texture.js @@ -20,6 +20,16 @@ import { let id = 0; +const PROPERTY_MIN_FILTER = 1; +const PROPERTY_MAG_FILTER = 2; +const PROPERTY_ADDRESS_U = 4; +const PROPERTY_ADDRESS_V = 8; +const PROPERTY_ADDRESS_W = 16; +const PROPERTY_COMPARE_ON_READ = 32; +const PROPERTY_COMPARE_FUNC = 64; +const PROPERTY_ANISOTROPY = 128; +const PROPERTY_ALL = 255; // 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128 + /** * A texture is a container for texel data that can be utilized in a fragment shader. Typically, * the texel data represents an image that is mapped over geometry. @@ -415,7 +425,7 @@ class Texture { Debug.warn("Texture#minFilter: minFilter property cannot be changed on an integer texture, will remain FILTER_NEAREST", this); } else { this._minFilter = v; - this.propertyChanged(1); + this.propertyChanged(PROPERTY_MIN_FILTER); } } } @@ -443,7 +453,7 @@ class Texture { Debug.warn("Texture#magFilter: magFilter property cannot be changed on an integer texture, will remain FILTER_NEAREST", this); } else { this._magFilter = v; - this.propertyChanged(2); + this.propertyChanged(PROPERTY_MAG_FILTER); } } } @@ -469,7 +479,7 @@ class Texture { set addressU(v) { if (this._addressU !== v) { this._addressU = v; - this.propertyChanged(4); + this.propertyChanged(PROPERTY_ADDRESS_U); } } @@ -494,7 +504,7 @@ class Texture { set addressV(v) { if (this._addressV !== v) { this._addressV = v; - this.propertyChanged(8); + this.propertyChanged(PROPERTY_ADDRESS_V); } } @@ -523,7 +533,7 @@ class Texture { } if (addressW !== this._addressW) { this._addressW = addressW; - this.propertyChanged(16); + this.propertyChanged(PROPERTY_ADDRESS_W); } } @@ -546,7 +556,7 @@ class Texture { set compareOnRead(v) { if (this._compareOnRead !== v) { this._compareOnRead = v; - this.propertyChanged(32); + this.propertyChanged(PROPERTY_COMPARE_ON_READ); } } @@ -574,7 +584,7 @@ class Texture { set compareFunc(v) { if (this._compareFunc !== v) { this._compareFunc = v; - this.propertyChanged(64); + this.propertyChanged(PROPERTY_COMPARE_FUNC); } } @@ -596,7 +606,7 @@ class Texture { set anisotropy(v) { if (this._anisotropy !== v) { this._anisotropy = v; - this.propertyChanged(128); + this.propertyChanged(PROPERTY_ANISOTROPY); } } @@ -817,7 +827,7 @@ class Texture { this._needsMipmapsUpload = this._mipmaps; this._mipmapsUploaded = false; - this.propertyChanged(255); // 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128 + this.propertyChanged(PROPERTY_ALL); } /**