Tweaked so cacheAsBitmap does not render the filters

rebuilt files
This commit is contained in:
Mat Groves 2014-02-17 21:43:58 +00:00
parent d33dbb4304
commit 951865f219
4 changed files with 66 additions and 68 deletions

View file

@ -744,6 +744,8 @@ PIXI.DisplayObject = function()
this._cacheAsBitmap = false; this._cacheAsBitmap = false;
this._cacheIsDirty = false; this._cacheIsDirty = false;
/* /*
* MOUSE Callbacks * MOUSE Callbacks
*/ */
@ -1041,15 +1043,13 @@ PIXI.DisplayObject.prototype.generateTexture = function(renderer)
return renderTexture; return renderTexture;
}; };
PIXI.DisplayObject.prototype.updateCache = function()
{
this._generateCachedSprite();
};
PIXI.DisplayObject.prototype._renderCachedSprite = function(renderSession) PIXI.DisplayObject.prototype._renderCachedSprite = function(renderSession)
{ {
// console.log(this._cacheIsDirty)
/* if(this._cacheIsDirty)
{
//this._generateCachedSprite(renderSession)
//this._cacheIsDirty = false;a
}*/
if(renderSession.gl) if(renderSession.gl)
{ {
PIXI.Sprite.prototype._renderWebGL.call(this._cachedSprite, renderSession); PIXI.Sprite.prototype._renderWebGL.call(this._cachedSprite, renderSession);
@ -1077,9 +1077,14 @@ PIXI.DisplayObject.prototype._generateCachedSprite = function()//renderSession)
this._cachedSprite.texture.resize(bounds.width | 0, bounds.height | 0); this._cachedSprite.texture.resize(bounds.width | 0, bounds.height | 0);
} }
//REMOVE filter!
var tempFilters = this._filters;
this._filters = null;
this._cachedSprite.filters = tempFilters;
this._cachedSprite.texture.render(this); this._cachedSprite.texture.render(this);
this._filters = tempFilters;
this._cacheAsBitmap = true; this._cacheAsBitmap = true;
}; };
@ -6637,10 +6642,10 @@ PIXI.WebGLSpriteBatch.prototype.render = function(sprite)
var trim = sprite.texture.trim; var trim = sprite.texture.trim;
w1 = trim.x - aX * trim.width; w1 = trim.x - aX * trim.width;
w0 = w1 + width; w0 = w1 + texture.frame.width;
h1 = trim.y - aY * trim.height; h1 = trim.y - aY * trim.height;
h0 = h1 + height; h0 = h1 + texture.frame.height;
} }
else else
@ -9894,58 +9899,46 @@ PIXI.TilingSprite.prototype._renderWebGL = function(renderSession)
var i,j; var i,j;
if(this.mask || this.filters) if(this.mask)
{ {
if(this.mask)
{
renderSession.spriteBatch.stop();
renderSession.maskManager.pushMask(this.mask, renderSession);
renderSession.spriteBatch.start();
}
if(this.filters)
{
renderSession.spriteBatch.flush();
renderSession.filterManager.pushFilter(this._filterBlock);
}
if(!this.tilingTexture || this.refreshTexture)this.generateTilingTexture(true);
else renderSession.spriteBatch.renderTilingSprite(this);
// simple render children!
for(i=0,j=this.children.length; i<j; i++)
{
this.children[i]._renderWebGL(renderSession);
}
renderSession.spriteBatch.stop(); renderSession.spriteBatch.stop();
renderSession.maskManager.pushMask(this.mask, renderSession);
if(this.filters)renderSession.filterManager.popFilter();
if(this.mask)renderSession.maskManager.popMask(renderSession);
renderSession.spriteBatch.start(); renderSession.spriteBatch.start();
} }
else
{
if(!this.tilingTexture || this.refreshTexture)
{
this.generateTilingTexture(true);
if(this.tilingTexture.needsUpdate)
{
//TODO - tweaking
PIXI.updateWebGLTexture(this.tilingTexture.baseTexture, renderSession.gl);
this.tilingTexture.needsUpdate = false;
// this.tilingTexture._uvs = null;
}
}
else renderSession.spriteBatch.renderTilingSprite(this);
// simple render children! if(this.filters)
for(i=0,j=this.children.length; i<j; i++) {
renderSession.spriteBatch.flush();
renderSession.filterManager.pushFilter(this._filterBlock);
}
if(!this.tilingTexture || this.refreshTexture)
{
this.generateTilingTexture(true);
if(this.tilingTexture && this.tilingTexture.needsUpdate)
{ {
this.children[i]._renderWebGL(renderSession); //TODO - tweaking
PIXI.updateWebGLTexture(this.tilingTexture.baseTexture, renderSession.gl);
this.tilingTexture.needsUpdate = false;
// this.tilingTexture._uvs = null;
} }
} }
else renderSession.spriteBatch.renderTilingSprite(this);
// simple render children!
for(i=0,j=this.children.length; i<j; i++)
{
this.children[i]._renderWebGL(renderSession);
}
renderSession.spriteBatch.stop();
if(this.filters)renderSession.filterManager.popFilter();
if(this.mask)renderSession.maskManager.popMask(renderSession);
renderSession.spriteBatch.start();
}; };
/** /**

File diff suppressed because one or more lines are too long

View file

@ -196,6 +196,8 @@ PIXI.DisplayObject = function()
this._cacheAsBitmap = false; this._cacheAsBitmap = false;
this._cacheIsDirty = false; this._cacheIsDirty = false;
/* /*
* MOUSE Callbacks * MOUSE Callbacks
*/ */
@ -493,15 +495,13 @@ PIXI.DisplayObject.prototype.generateTexture = function(renderer)
return renderTexture; return renderTexture;
}; };
PIXI.DisplayObject.prototype.updateCache = function()
{
this._generateCachedSprite();
};
PIXI.DisplayObject.prototype._renderCachedSprite = function(renderSession) PIXI.DisplayObject.prototype._renderCachedSprite = function(renderSession)
{ {
// console.log(this._cacheIsDirty)
/* if(this._cacheIsDirty)
{
//this._generateCachedSprite(renderSession)
//this._cacheIsDirty = false;a
}*/
if(renderSession.gl) if(renderSession.gl)
{ {
PIXI.Sprite.prototype._renderWebGL.call(this._cachedSprite, renderSession); PIXI.Sprite.prototype._renderWebGL.call(this._cachedSprite, renderSession);
@ -529,9 +529,14 @@ PIXI.DisplayObject.prototype._generateCachedSprite = function()//renderSession)
this._cachedSprite.texture.resize(bounds.width | 0, bounds.height | 0); this._cachedSprite.texture.resize(bounds.width | 0, bounds.height | 0);
} }
//REMOVE filter!
var tempFilters = this._filters;
this._filters = null;
this._cachedSprite.filters = tempFilters;
this._cachedSprite.texture.render(this); this._cachedSprite.texture.render(this);
this._filters = tempFilters;
this._cacheAsBitmap = true; this._cacheAsBitmap = true;
}; };

View file

@ -177,10 +177,10 @@ PIXI.WebGLSpriteBatch.prototype.render = function(sprite)
var trim = sprite.texture.trim; var trim = sprite.texture.trim;
w1 = trim.x - aX * trim.width; w1 = trim.x - aX * trim.width;
w0 = w1 + width; w0 = w1 + texture.frame.width;
h1 = trim.y - aY * trim.height; h1 = trim.y - aY * trim.height;
h0 = h1 + height; h0 = h1 + texture.frame.height;
} }
else else