Text added to PIXI
destroy function added to textures too docs updated new example added
This commit is contained in:
parent
7933cadb77
commit
09dbbd5d13
66 changed files with 10970 additions and 681 deletions
|
@ -67,6 +67,8 @@
|
|||
|
||||
<li><a href="../classes/Stage.html">Stage</a></li>
|
||||
|
||||
<li><a href="../classes/Text.html">Text</a></li>
|
||||
|
||||
<li><a href="../classes/Texture.html">Texture</a></li>
|
||||
|
||||
<li><a href="../classes/TilingSprite.html">TilingSprite</a></li>
|
||||
|
@ -142,6 +144,8 @@ PIXI._defaultFrame = new PIXI.Rectangle(0,0,1,1);
|
|||
*/
|
||||
PIXI.WebGLRenderer = function(width, height, view, transparent)
|
||||
{
|
||||
// do a catch.. only 1 webGL renderer..
|
||||
|
||||
//console.log(transparent)
|
||||
this.transparent = !!transparent;
|
||||
|
||||
|
@ -190,6 +194,31 @@ PIXI.WebGLRenderer = function(width, height, view, transparent)
|
|||
// constructor
|
||||
PIXI.WebGLRenderer.constructor = PIXI.WebGLRenderer;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
PIXI.WebGLRenderer.prototype.getBatch = function()
|
||||
{
|
||||
if(PIXI._batchs.length == 0)
|
||||
{
|
||||
return new PIXI.WebGLBatch(this.gl);
|
||||
}
|
||||
else
|
||||
{
|
||||
return PIXI._batchs.pop();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
PIXI.WebGLRenderer.prototype.returnBatch = function(batch)
|
||||
{
|
||||
batch.clean();
|
||||
PIXI._batchs.push(batch);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
|
@ -307,12 +336,13 @@ PIXI.WebGLRenderer.prototype.render = function(stage)
|
|||
|
||||
// update any textures
|
||||
for (var i=0; i < PIXI.texturesToUpdate.length; i++) this.updateTexture(PIXI.texturesToUpdate[i]);
|
||||
for (var i=0; i < PIXI.texturesToDestroy.length; i++) this.destroyTexture(PIXI.texturesToDestroy[i]);
|
||||
|
||||
// empty out the arrays
|
||||
stage.__childrenRemoved = [];
|
||||
stage.__childrenAdded = [];
|
||||
PIXI.texturesToUpdate = [];
|
||||
|
||||
PIXI.texturesToDestroy = [];
|
||||
// recursivly loop through all items!
|
||||
this.checkVisibility(stage, true);
|
||||
|
||||
|
@ -362,6 +392,17 @@ PIXI.WebGLRenderer.prototype.render = function(stage)
|
|||
stage.interactionManager.setTarget(this);
|
||||
}
|
||||
}
|
||||
|
||||
// after rendering lets confirm all frames that have been uodated..
|
||||
if(PIXI.Texture.frameUpdates.length > 0)
|
||||
{
|
||||
for (var i=0; i < PIXI.Texture.frameUpdates.length; i++)
|
||||
{
|
||||
PIXI.Texture.frameUpdates[i].updateFrame = false;
|
||||
};
|
||||
|
||||
PIXI.Texture.frameUpdates = [];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -406,12 +447,23 @@ PIXI.WebGLRenderer.prototype.updateTexture = function(texture)
|
|||
this.refreshBatchs = true;
|
||||
}
|
||||
|
||||
PIXI.WebGLRenderer.prototype.destroyTexture = function(texture)
|
||||
{
|
||||
var gl = this.gl;
|
||||
|
||||
if(texture._glTexture)
|
||||
{
|
||||
texture._glTexture = gl.createTexture();
|
||||
gl.deleteTexture(gl.TEXTURE_2D, texture._glTexture);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
PIXI.WebGLRenderer.prototype.addDisplayObject = function(displayObject)
|
||||
{
|
||||
|
||||
var objectDetaildisplayObject
|
||||
if(!displayObject.stage)return; // means it was removed
|
||||
if(displayObject.__inWebGL)return; //means it is already in webgL
|
||||
|
||||
|
@ -552,7 +604,7 @@ PIXI.WebGLRenderer.prototype.addDisplayObject = function(displayObject)
|
|||
* seems the new sprite is in the middle of a batch
|
||||
* lets split it..
|
||||
*/
|
||||
var batch = PIXI._getBatch(this.gl);
|
||||
var batch = this.getBatch();
|
||||
|
||||
var index = this.batchs.indexOf( previousBatch );
|
||||
batch.init(displayObject);
|
||||
|
@ -576,7 +628,7 @@ PIXI.WebGLRenderer.prototype.addDisplayObject = function(displayObject)
|
|||
* time to create anew one!
|
||||
*/
|
||||
|
||||
var batch = PIXI._getBatch(this.gl);
|
||||
var batch = this.getBatch();
|
||||
batch.init(displayObject);
|
||||
|
||||
if(previousBatch) // if this is invalid it means
|
||||
|
@ -635,7 +687,6 @@ PIXI.WebGLRenderer.prototype.removeDisplayObject = function(displayObject)
|
|||
|
||||
batch.remove(displayObject);
|
||||
|
||||
|
||||
if(batch.size==0)
|
||||
{
|
||||
batchToRemove = batch
|
||||
|
@ -660,7 +711,7 @@ PIXI.WebGLRenderer.prototype.removeDisplayObject = function(displayObject)
|
|||
{
|
||||
// wha - eva! just get of the empty batch!
|
||||
this.batchs.splice(index, 1);
|
||||
if(batchToRemove instanceof PIXI.WebGLBatch)PIXI._returnBatch(batchToRemove);
|
||||
if(batchToRemove instanceof PIXI.WebGLBatch)this.returnBatch(batchToRemove);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -672,8 +723,8 @@ PIXI.WebGLRenderer.prototype.removeDisplayObject = function(displayObject)
|
|||
//console.log("MERGE")
|
||||
this.batchs[index-1].merge(this.batchs[index+1]);
|
||||
|
||||
if(batchToRemove instanceof PIXI.WebGLBatch)PIXI._returnBatch(batchToRemove);
|
||||
PIXI._returnBatch(this.batchs[index+1]);
|
||||
if(batchToRemove instanceof PIXI.WebGLBatch)this.returnBatch(batchToRemove);
|
||||
this.returnBatch(this.batchs[index+1]);
|
||||
this.batchs.splice(index, 2);
|
||||
return;
|
||||
}
|
||||
|
@ -681,7 +732,7 @@ PIXI.WebGLRenderer.prototype.removeDisplayObject = function(displayObject)
|
|||
|
||||
|
||||
this.batchs.splice(index, 1);
|
||||
if(batchToRemove instanceof PIXI.WebGLBatch)PIXI._returnBatch(batchToRemove);
|
||||
if(batchToRemove instanceof PIXI.WebGLBatch)this.returnBatch(batchToRemove);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue