Skip to content

Commit aa9ea30

Browse files
committed
Working through fixing TilingSprites for WebGL.
1 parent 05d0a94 commit aa9ea30

3 files changed

Lines changed: 23 additions & 10 deletions

File tree

src/animation/AnimationManager.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,7 @@ Phaser.AnimationManager.prototype = {
404404
*/
405405
refreshFrame: function () {
406406

407+
// TODO
407408
this.sprite.setTexture(PIXI.TextureCache[this.currentFrame.uuid]);
408409

409410
},

src/pixi/extras/TilingSprite.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,10 @@ PIXI.TilingSprite.prototype._renderWebGL = function(renderSession)
169169
renderSession.renderer.updateTexture(this.tilingTexture.baseTexture);
170170
this.tilingTexture.needsUpdate = false;
171171
}
172+
else
173+
{
174+
return;
175+
}
172176
}
173177
else
174178
{
@@ -182,8 +186,15 @@ PIXI.TilingSprite.prototype._renderWebGL = function(renderSession)
182186

183187
renderSession.spriteBatch.stop();
184188

185-
if (this._filters) renderSession.filterManager.popFilter();
186-
if (this._mask) renderSession.maskManager.popMask(this._mask, renderSession);
189+
if (this._filters)
190+
{
191+
renderSession.filterManager.popFilter();
192+
}
193+
194+
if (this._mask)
195+
{
196+
renderSession.maskManager.popMask(this._mask, renderSession);
197+
}
187198

188199
renderSession.spriteBatch.start();
189200
};
@@ -353,6 +364,7 @@ PIXI.TilingSprite.prototype.generateTilingTexture = function(forcePowerOfTwo)
353364
this.canvasBuffer = new PIXI.CanvasBuffer(targetWidth, targetHeight);
354365
this.tilingTexture = PIXI.Texture.fromCanvas(this.canvasBuffer.canvas);
355366
this.tilingTexture.isTiling = true;
367+
this.tilingTexture.needsUpdate = true;
356368
// Phaser.Canvas.addToDOM(this.canvasBuffer.canvas, document.body, false);
357369
}
358370

src/pixi/renderers/webgl/utils/WebGLSpriteBatch.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,6 @@ PIXI.WebGLSpriteBatch.prototype.render = function(sprite, matrix)
231231
return;
232232
}
233233

234-
// TODO trim??
235234
var aX = sprite.anchor.x;
236235
var aY = sprite.anchor.y;
237236

@@ -346,6 +345,7 @@ PIXI.WebGLSpriteBatch.prototype.renderTilingSprite = function(tilingSprite)
346345
// check texture..
347346
if (this.currentBatchSize >= this.size)
348347
{
348+
console.log('batch flush');
349349
//return;
350350
this.flush();
351351
this.currentBaseTexture = texture.baseTexture;
@@ -403,14 +403,14 @@ PIXI.WebGLSpriteBatch.prototype.renderTilingSprite = function(tilingSprite)
403403

404404
var resolution = texture.baseTexture.resolution;
405405

406-
var worldTransform = tilingSprite.worldTransform;
406+
var wt = tilingSprite.wt;
407407

408-
var a = worldTransform.a / resolution;//[0];
409-
var b = worldTransform.b / resolution;//[3];
410-
var c = worldTransform.c / resolution;//[1];
411-
var d = worldTransform.d / resolution;//[4];
412-
var tx = worldTransform.tx;//[2];
413-
var ty = worldTransform.ty;//[5];
408+
var a = wt.a / resolution;
409+
var b = wt.b / resolution;
410+
var c = wt.c / resolution;
411+
var d = wt.d / resolution;
412+
var tx = wt.tx;
413+
var ty = wt.ty;
414414

415415
// xy
416416
positions[index++] = a * w1 + c * h1 + tx;

0 commit comments

Comments
 (0)