Skip to content

Commit 6f351ff

Browse files
committed
Texture.requiresReTint is a new property that controls if a texture requires the display object to be re-tinted having been updated internally. The LoadTexture component now sets this.
1 parent 164039d commit 6f351ff

2 files changed

Lines changed: 11 additions & 8 deletions

File tree

src/gameobjects/components/LoadTexture.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Phaser.Component.LoadTexture.prototype = {
2929
* Calling this method causes a WebGL texture update, so use sparingly or in low-intensity portions of your game, or if you know the new texture is already on the GPU.
3030
*
3131
* @method
32-
* @param {string|Phaser.RenderTexture|Phaser.BitmapData|PIXI.Texture} key - This is the image or texture used by the Sprite during rendering. It can be a string which is a reference to the Cache Image entry, or an instance of a RenderTexture, BitmapData or PIXI.Texture.
32+
* @param {string|Phaser.RenderTexture|Phaser.BitmapData|Phaser.Video|PIXI.Texture} key - This is the image or texture used by the Sprite during rendering. It can be a string which is a reference to the Cache Image entry, or an instance of a RenderTexture, BitmapData, Video or PIXI.Texture.
3333
* @param {string|number} [frame] - If this Sprite is using part of a sprite sheet or texture atlas you can specify the exact frame to use by giving a string or numeric index.
3434
* @param {boolean} [stopAnimation=true] - If an animation is already playing on this Sprite you can choose to stop it or let it carry on playing.
3535
*/
@@ -46,13 +46,11 @@ Phaser.Component.LoadTexture.prototype = {
4646

4747
var setFrame = true;
4848
var smoothed = !this.texture.baseTexture.scaleMode;
49-
var isRenderTexture = false;
5049

5150
if (Phaser.RenderTexture && key instanceof Phaser.RenderTexture)
5251
{
5352
this.key = key.key;
5453
this.setTexture(key);
55-
isRenderTexture = true;
5654
}
5755
else if (Phaser.BitmapData && key instanceof Phaser.BitmapData)
5856
{
@@ -159,11 +157,8 @@ Phaser.Component.LoadTexture.prototype = {
159157
this.updateCrop();
160158
}
161159

162-
if (this.tint !== 0xFFFFFF)
163-
{
164-
this.cachedTint = -1;
165-
}
166-
160+
this.texture.requiresReTint = true;
161+
167162
this.texture._updateUvs();
168163

169164
if (this.tilingTexture)

src/pixi/textures/Texture.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,14 @@ PIXI.Texture = function(baseTexture, frame, crop, trim)
9797
*/
9898
this.requiresUpdate = false;
9999

100+
/**
101+
* This will let a renderer know that a tinted parent has updated its texture.
102+
*
103+
* @property requiresReTint
104+
* @type Boolean
105+
*/
106+
this.requiresReTint = false;
107+
100108
/**
101109
* The WebGL UV data cache.
102110
*

0 commit comments

Comments
 (0)