mirror of
https://github.com/photonstorm/phaser
synced 2025-02-16 05:58:30 +00:00
Fixed multi texture support on tiling sprite.
This commit is contained in:
parent
e15d98e34b
commit
1711266ff8
2 changed files with 8 additions and 11 deletions
|
@ -180,6 +180,7 @@ PIXI.TilingSprite.prototype._renderWebGL = function(renderSession)
|
|||
{
|
||||
if (this.tilingTexture.needsUpdate)
|
||||
{
|
||||
this.tilingTexture.baseTexture.textureIndex = this.texture.baseTexture.textureIndex;
|
||||
renderSession.renderer.updateTexture(this.tilingTexture.baseTexture);
|
||||
this.tilingTexture.needsUpdate = false;
|
||||
}
|
||||
|
@ -197,7 +198,7 @@ PIXI.TilingSprite.prototype._renderWebGL = function(renderSession)
|
|||
this.children[i]._renderWebGL(renderSession);
|
||||
}
|
||||
|
||||
renderSession.spriteBatch.stop();
|
||||
//renderSession.spriteBatch.stop();
|
||||
|
||||
if (this._filters)
|
||||
{
|
||||
|
@ -209,7 +210,7 @@ PIXI.TilingSprite.prototype._renderWebGL = function(renderSession)
|
|||
renderSession.maskManager.popMask(this._mask, renderSession);
|
||||
}
|
||||
|
||||
renderSession.spriteBatch.start();
|
||||
//renderSession.spriteBatch.start();
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -362,12 +362,12 @@ PIXI.WebGLSpriteBatch.prototype.renderTilingSprite = function (sprite) {
|
|||
var texture = sprite.tilingTexture;
|
||||
var baseTexture = texture.baseTexture;
|
||||
var gl = this.gl;
|
||||
|
||||
if (this.textureArray[baseTexture.textureIndex] != baseTexture) {
|
||||
gl.activeTexture(gl.TEXTURE0 + baseTexture.textureIndex);
|
||||
gl.bindTexture(gl.TEXTURE_2D, baseTexture._glTextures[gl.id]);
|
||||
this.textureArray[baseTexture.textureIndex] = baseTexture;
|
||||
var textureIndex = sprite.texture.baseTexture.textureIndex;
|
||||
if (this.textureArray[textureIndex] != baseTexture) {
|
||||
this.flush();
|
||||
gl.activeTexture(gl.TEXTURE0 + textureIndex);
|
||||
gl.bindTexture(gl.TEXTURE_2D, baseTexture._glTextures[gl.id]);
|
||||
this.textureArray[textureIndex] = baseTexture;
|
||||
}
|
||||
|
||||
// check texture..
|
||||
|
@ -444,7 +444,6 @@ PIXI.WebGLSpriteBatch.prototype.renderTilingSprite = function (sprite) {
|
|||
var d = wt.d / resolution;
|
||||
var tx = wt.tx;
|
||||
var ty = wt.ty;
|
||||
var textureIndex = texture.baseTexture.textureIndex;
|
||||
// xy
|
||||
positions[i++] = a * w1 + c * h1 + tx;
|
||||
positions[i++] = d * h1 + b * w1 + ty;
|
||||
|
@ -651,9 +650,6 @@ PIXI.WebGLSpriteBatch.prototype.renderBatch = function (texture, size, startInde
|
|||
// If updateTexture returns false then we cannot render it, so bail out now
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
gl.activeTexture(gl.TEXTURE0 + texture.textureIndex);
|
||||
gl.bindTexture(gl.TEXTURE_2D, texture._glTextures[gl.id]);
|
||||
}
|
||||
gl.drawElements(gl.TRIANGLES, size * 6, gl.UNSIGNED_SHORT, startIndex * 6 * 2);
|
||||
// increment the draw count
|
||||
|
|
Loading…
Add table
Reference in a new issue