Skip to content

Commit 15fd1bc

Browse files
committed
Texture property changes flags
1 parent ee081e3 commit 15fd1bc

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
}
@@ -439,7 +449,7 @@ class Texture {
439449
Debug.warn("Texture#magFilter: magFilter property cannot be changed on an integer texture, will remain FILTER_NEAREST", this);
440450
} else {
441451
this._magFilter = v;
442-
this.propertyChanged(2);
452+
this.propertyChanged(PROPERTY_MAG_FILTER);
443453
}
444454
}
445455
}
@@ -460,7 +470,7 @@ class Texture {
460470
set addressU(v) {
461471
if (this._addressU !== v) {
462472
this._addressU = v;
463-
this.propertyChanged(4);
473+
this.propertyChanged(PROPERTY_ADDRESS_U);
464474
}
465475
}
466476

@@ -480,7 +490,7 @@ class Texture {
480490
set addressV(v) {
481491
if (this._addressV !== v) {
482492
this._addressV = v;
483-
this.propertyChanged(8);
493+
this.propertyChanged(PROPERTY_ADDRESS_V);
484494
}
485495
}
486496

@@ -504,7 +514,7 @@ class Texture {
504514
}
505515
if (addressW !== this._addressW) {
506516
this._addressW = addressW;
507-
this.propertyChanged(16);
517+
this.propertyChanged(PROPERTY_ADDRESS_W);
508518
}
509519
}
510520

@@ -522,7 +532,7 @@ class Texture {
522532
set compareOnRead(v) {
523533
if (this._compareOnRead !== v) {
524534
this._compareOnRead = v;
525-
this.propertyChanged(32);
535+
this.propertyChanged(PROPERTY_COMPARE_ON_READ);
526536
}
527537
}
528538

@@ -545,7 +555,7 @@ class Texture {
545555
set compareFunc(v) {
546556
if (this._compareFunc !== v) {
547557
this._compareFunc = v;
548-
this.propertyChanged(64);
558+
this.propertyChanged(PROPERTY_COMPARE_FUNC);
549559
}
550560
}
551561

@@ -562,7 +572,7 @@ class Texture {
562572
set anisotropy(v) {
563573
if (this._anisotropy !== v) {
564574
this._anisotropy = v;
565-
this.propertyChanged(128);
575+
this.propertyChanged(PROPERTY_ANISOTROPY);
566576
}
567577
}
568578

@@ -768,7 +778,7 @@ class Texture {
768778
this._needsMipmapsUpload = this._mipmaps;
769779
this._mipmapsUploaded = false;
770780

771-
this.propertyChanged(255); // 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128
781+
this.propertyChanged(PROPERTY_ALL);
772782
}
773783

774784
/**

0 commit comments

Comments
 (0)