Skip to content

Commit 3d887a5

Browse files
committed
Texture property changes flags
1 parent dd2dab3 commit 3d887a5

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

src/platform/graphics/texture.js

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@ import {
2020

2121
let id = 0;
2222

23+
const PROPERTY_MIN_FILTER = 1;
24+
const PROPERTY_MAG_FILTER = 2;
25+
const PROPERTY_ADDRESS_U = 4;
26+
const PROPERTY_ADDRESS_V = 8;
27+
const PROPERTY_ADDRESS_W = 16;
28+
const PROPERTY_COMPARE_ON_READ = 32;
29+
const PROPERTY_COMPARE_FUNC = 64;
30+
const PROPERTY_ANISOTROPY = 128;
31+
const PROPERTY_ALL = 255; // 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128
32+
2333
/**
2434
* A texture is a container for texel data that can be utilized in a fragment shader. Typically,
2535
* the texel data represents an image that is mapped over geometry.
@@ -416,7 +426,7 @@ class Texture {
416426
Debug.warn("Texture#minFilter: minFilter property cannot be changed on an integer texture, will remain FILTER_NEAREST", this);
417427
} else {
418428
this._minFilter = v;
419-
this.propertyChanged(1);
429+
this.propertyChanged(PROPERTY_MIN_FILTER);
420430
}
421431
}
422432
}
@@ -444,7 +454,7 @@ class Texture {
444454
Debug.warn("Texture#magFilter: magFilter property cannot be changed on an integer texture, will remain FILTER_NEAREST", this);
445455
} else {
446456
this._magFilter = v;
447-
this.propertyChanged(2);
457+
this.propertyChanged(PROPERTY_MAG_FILTER);
448458
}
449459
}
450460
}
@@ -470,7 +480,7 @@ class Texture {
470480
set addressU(v) {
471481
if (this._addressU !== v) {
472482
this._addressU = v;
473-
this.propertyChanged(4);
483+
this.propertyChanged(PROPERTY_ADDRESS_U);
474484
}
475485
}
476486

@@ -495,7 +505,7 @@ class Texture {
495505
set addressV(v) {
496506
if (this._addressV !== v) {
497507
this._addressV = v;
498-
this.propertyChanged(8);
508+
this.propertyChanged(PROPERTY_ADDRESS_V);
499509
}
500510
}
501511

@@ -524,7 +534,7 @@ class Texture {
524534
}
525535
if (addressW !== this._addressW) {
526536
this._addressW = addressW;
527-
this.propertyChanged(16);
537+
this.propertyChanged(PROPERTY_ADDRESS_W);
528538
}
529539
}
530540

@@ -547,7 +557,7 @@ class Texture {
547557
set compareOnRead(v) {
548558
if (this._compareOnRead !== v) {
549559
this._compareOnRead = v;
550-
this.propertyChanged(32);
560+
this.propertyChanged(PROPERTY_COMPARE_ON_READ);
551561
}
552562
}
553563

@@ -575,7 +585,7 @@ class Texture {
575585
set compareFunc(v) {
576586
if (this._compareFunc !== v) {
577587
this._compareFunc = v;
578-
this.propertyChanged(64);
588+
this.propertyChanged(PROPERTY_COMPARE_FUNC);
579589
}
580590
}
581591

@@ -597,7 +607,7 @@ class Texture {
597607
set anisotropy(v) {
598608
if (this._anisotropy !== v) {
599609
this._anisotropy = v;
600-
this.propertyChanged(128);
610+
this.propertyChanged(PROPERTY_ANISOTROPY);
601611
}
602612
}
603613

@@ -818,7 +828,7 @@ class Texture {
818828
this._needsMipmapsUpload = this._mipmaps;
819829
this._mipmapsUploaded = false;
820830

821-
this.propertyChanged(255); // 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128
831+
this.propertyChanged(PROPERTY_ALL);
822832
}
823833

824834
/**

0 commit comments

Comments
 (0)