Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 19 additions & 9 deletions src/platform/graphics/texture.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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);
}
}
}
Expand Down Expand Up @@ -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);
}
}
}
Expand All @@ -469,7 +479,7 @@ class Texture {
set addressU(v) {
if (this._addressU !== v) {
this._addressU = v;
this.propertyChanged(4);
this.propertyChanged(PROPERTY_ADDRESS_U);
}
}

Expand All @@ -494,7 +504,7 @@ class Texture {
set addressV(v) {
if (this._addressV !== v) {
this._addressV = v;
this.propertyChanged(8);
this.propertyChanged(PROPERTY_ADDRESS_V);
}
}

Expand Down Expand Up @@ -523,7 +533,7 @@ class Texture {
}
if (addressW !== this._addressW) {
this._addressW = addressW;
this.propertyChanged(16);
this.propertyChanged(PROPERTY_ADDRESS_W);
}
}

Expand All @@ -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);
}
}

Expand Down Expand Up @@ -574,7 +584,7 @@ class Texture {
set compareFunc(v) {
if (this._compareFunc !== v) {
this._compareFunc = v;
this.propertyChanged(64);
this.propertyChanged(PROPERTY_COMPARE_FUNC);
}
}

Expand All @@ -596,7 +606,7 @@ class Texture {
set anisotropy(v) {
if (this._anisotropy !== v) {
this._anisotropy = v;
this.propertyChanged(128);
this.propertyChanged(PROPERTY_ANISOTROPY);
}
}

Expand Down Expand Up @@ -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);
}

/**
Expand Down