Docs updated Builds updated
This commit is contained in:
parent
b1b2e417a3
commit
69b3be322e
93 changed files with 6214 additions and 1190 deletions
|
@ -53,12 +53,16 @@
|
|||
|
||||
<li><a href="../classes/CanvasRenderer.html">CanvasRenderer</a></li>
|
||||
|
||||
<li><a href="../classes/Circle.html">Circle</a></li>
|
||||
|
||||
<li><a href="../classes/CustomRenderable.html">CustomRenderable</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObject.html">DisplayObject</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
|
||||
|
||||
<li><a href="../classes/Ellipse.html">Ellipse</a></li>
|
||||
|
||||
<li><a href="../classes/Graphics.html">Graphics</a></li>
|
||||
|
||||
<li><a href="../classes/ImageLoader.html">ImageLoader</a></li>
|
||||
|
@ -166,7 +170,6 @@ PIXI.WebGLRenderGroup = function(gl)
|
|||
this.toRemove = [];
|
||||
}
|
||||
|
||||
|
||||
// constructor
|
||||
PIXI.WebGLRenderGroup.constructor = PIXI.WebGLRenderGroup;
|
||||
|
||||
|
@ -182,9 +185,7 @@ PIXI.WebGLRenderGroup.prototype.setRenderable = function(displayObject)
|
|||
|
||||
// TODO what if its already has an object? should remove it
|
||||
this.root = displayObject;
|
||||
//displayObject.__renderGroup = this;
|
||||
this.addDisplayObjectAndChildren(displayObject);
|
||||
//displayObject
|
||||
}
|
||||
|
||||
PIXI.WebGLRenderGroup.prototype.render = function(projection)
|
||||
|
@ -193,11 +194,9 @@ PIXI.WebGLRenderGroup.prototype.render = function(projection)
|
|||
|
||||
var gl = this.gl;
|
||||
|
||||
// set the flipped matrix..
|
||||
// gl.uniformMatrix4fv(PIXI.shaderProgram.mvMatrixUniform, false, PIXI.projectionMatrix);
|
||||
|
||||
gl.uniform2f(PIXI.shaderProgram.projectionVector, projection.x, projection.y);
|
||||
|
||||
gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
// TODO remove this by replacing visible with getter setters..
|
||||
this.checkVisibility(this.root, this.root.visible);
|
||||
|
||||
|
@ -222,12 +221,41 @@ PIXI.WebGLRenderGroup.prototype.render = function(projection)
|
|||
}
|
||||
else if(renderable instanceof PIXI.Graphics)
|
||||
{
|
||||
if(renderable.visible) PIXI.WebGLGraphics.renderGraphics(renderable, projection);//, projectionMatrix);
|
||||
if(renderable.visible && renderable.renderable) PIXI.WebGLGraphics.renderGraphics(renderable, projection);//, projectionMatrix);
|
||||
}
|
||||
else if(renderable instanceof PIXI.FilterBlock)
|
||||
{
|
||||
/*
|
||||
* for now only masks are supported..
|
||||
*/
|
||||
if(renderable.open)
|
||||
{
|
||||
gl.enable(gl.STENCIL_TEST);
|
||||
|
||||
gl.colorMask(false, false, false, false);
|
||||
gl.stencilFunc(gl.ALWAYS,1,0xff);
|
||||
gl.stencilOp(gl.KEEP,gl.KEEP,gl.REPLACE);
|
||||
|
||||
PIXI.WebGLGraphics.renderGraphics(renderable.mask, projection);
|
||||
|
||||
gl.colorMask(true, true, true, false);
|
||||
gl.stencilFunc(gl.NOTEQUAL,0,0xff);
|
||||
gl.stencilOp(gl.KEEP,gl.KEEP,gl.KEEP);
|
||||
}
|
||||
else
|
||||
{
|
||||
gl.disable(gl.STENCIL_TEST);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
PIXI.WebGLRenderGroup.prototype.handleFilter = function(filter, projection)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
PIXI.WebGLRenderGroup.prototype.renderSpecific = function(displayObject, projection)
|
||||
{
|
||||
PIXI.WebGLRenderer.updateTextures();
|
||||
|
@ -238,8 +266,6 @@ PIXI.WebGLRenderGroup.prototype.renderSpecific = function(displayObject, project
|
|||
// gl.uniformMatrix4fv(PIXI.shaderProgram.mvMatrixUniform, false, projectionMatrix);
|
||||
gl.uniform2f(PIXI.shaderProgram.projectionVector, projection.x, projection.y);
|
||||
|
||||
|
||||
//console.log("SPECIFIC");
|
||||
// to do!
|
||||
// render part of the scene...
|
||||
|
||||
|
@ -249,8 +275,18 @@ PIXI.WebGLRenderGroup.prototype.renderSpecific = function(displayObject, project
|
|||
var endIndex;
|
||||
var endBatchIndex;
|
||||
|
||||
// get NEXT Renderable!
|
||||
var nextRenderable = displayObject.renderable ? displayObject : this.getNextRenderable(displayObject);
|
||||
/*
|
||||
* LOOK FOR THE NEXT SPRITE
|
||||
* This part looks for the closest next sprite that can go into a batch
|
||||
* it keeps looking until it finds a sprite or gets to the end of the display
|
||||
* scene graph
|
||||
*/
|
||||
var nextRenderable = displayObject.last;
|
||||
while(nextRenderable._iNext)
|
||||
{
|
||||
nextRenderable = nextRenderable._iNext;
|
||||
if(nextRenderable.renderable && nextRenderable.__renderGroup)break;
|
||||
}
|
||||
var startBatch = nextRenderable.batch;
|
||||
|
||||
if(nextRenderable instanceof PIXI.Sprite)
|
||||
|
@ -388,20 +424,44 @@ PIXI.WebGLRenderGroup.prototype.renderSpecial = function(renderable)
|
|||
}
|
||||
else if(renderable instanceof PIXI.Graphics)
|
||||
{
|
||||
if(renderable.visible) PIXI.WebGLGraphics.renderGraphics(renderable);//, projectionMatrix);
|
||||
if(renderable.visible && renderable.renderable) PIXI.WebGLGraphics.renderGraphics(renderable);//, projectionMatrix);
|
||||
}
|
||||
else if(renderable instanceof PIXI.FilterBlock)
|
||||
{
|
||||
/*
|
||||
* for now only masks are supported..
|
||||
*/
|
||||
if(renderable.open)
|
||||
{
|
||||
gl.enable(gl.STENCIL_TEST);
|
||||
|
||||
gl.colorMask(false, false, false, false);
|
||||
gl.stencilFunc(gl.ALWAYS,1,0xff);
|
||||
gl.stencilOp(gl.KEEP,gl.KEEP,gl.REPLACE);
|
||||
|
||||
PIXI.WebGLGraphics.renderGraphics(renderable.mask, projection);
|
||||
|
||||
gl.colorMask(true, true, true, false);
|
||||
gl.stencilFunc(gl.NOTEQUAL,0,0xff);
|
||||
gl.stencilOp(gl.KEEP,gl.KEEP,gl.KEEP);
|
||||
}
|
||||
else
|
||||
{
|
||||
gl.disable(gl.STENCIL_TEST);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PIXI.WebGLRenderGroup.prototype.checkVisibility = function(displayObject, globalVisible)
|
||||
{
|
||||
// give the dp a refference to its renderGroup...
|
||||
// give the dp a reference to its renderGroup...
|
||||
var children = displayObject.children;
|
||||
//displayObject.worldVisible = globalVisible;
|
||||
for (var i=0; i < children.length; i++)
|
||||
{
|
||||
var child = children[i];
|
||||
|
||||
// TODO optimize... shouldt need to loop through everything all the time
|
||||
// TODO optimize... should'nt need to loop through everything all the time
|
||||
child.worldVisible = child.visible && globalVisible;
|
||||
|
||||
// everything should have a batch!
|
||||
|
@ -409,12 +469,7 @@ PIXI.WebGLRenderGroup.prototype.checkVisibility = function(displayObject, global
|
|||
if(child.textureChange)
|
||||
{
|
||||
child.textureChange = false;
|
||||
if(child.worldVisible)
|
||||
{
|
||||
this.removeDisplayObject(child);
|
||||
this.addDisplayObject(child);
|
||||
//this.updateTexture(child);
|
||||
}
|
||||
if(child.worldVisible)this.updateTexture(child);
|
||||
// update texture!!
|
||||
}
|
||||
|
||||
|
@ -427,123 +482,150 @@ PIXI.WebGLRenderGroup.prototype.checkVisibility = function(displayObject, global
|
|||
|
||||
PIXI.WebGLRenderGroup.prototype.updateTexture = function(displayObject)
|
||||
{
|
||||
// we know this exists..
|
||||
// is it in a batch..
|
||||
// check batch length
|
||||
if(displayObject.batch.length == 1)
|
||||
|
||||
// TODO definitely can optimse this function..
|
||||
|
||||
this.removeObject(displayObject);
|
||||
|
||||
/*
|
||||
* LOOK FOR THE PREVIOUS RENDERABLE
|
||||
* This part looks for the closest previous sprite that can go into a batch
|
||||
* It keeps going back until it finds a sprite or the stage
|
||||
*/
|
||||
var previousRenderable = displayObject.first;
|
||||
while(previousRenderable != this.root)
|
||||
{
|
||||
// just one! this guy! so simply swap the texture
|
||||
displayObject.batch.texture = displayObject.texture.baseTexture;
|
||||
return;
|
||||
previousRenderable = previousRenderable._iPrev;
|
||||
if(previousRenderable.renderable && previousRenderable.__renderGroup)break;
|
||||
}
|
||||
|
||||
// early out!
|
||||
if(displayObject.batch.texture == displayObject.texture.baseTexture)return;
|
||||
/*
|
||||
* LOOK FOR THE NEXT SPRITE
|
||||
* This part looks for the closest next sprite that can go into a batch
|
||||
* it keeps looking until it finds a sprite or gets to the end of the display
|
||||
* scene graph
|
||||
*/
|
||||
var nextRenderable = displayObject.last;
|
||||
while(nextRenderable._iNext)
|
||||
{
|
||||
nextRenderable = nextRenderable._iNext;
|
||||
if(nextRenderable.renderable && nextRenderable.__renderGroup)break;
|
||||
}
|
||||
|
||||
|
||||
if(displayObject.batch.head == displayObject)
|
||||
{
|
||||
//console.log("HEAD")
|
||||
var currentBatch = displayObject.batch;
|
||||
|
||||
var index = this.batchs.indexOf( currentBatch );
|
||||
var previousBatch = this.batchs[index-1];
|
||||
currentBatch.remove(displayObject);
|
||||
|
||||
if(previousBatch)
|
||||
{
|
||||
if(previousBatch.texture == displayObject.texture.baseTexture && previousBatch.blendMode == displayObject.blendMode)
|
||||
{
|
||||
previousBatch.insertAfter(displayObject, previousBatch.tail);
|
||||
}
|
||||
else
|
||||
{
|
||||
// add it before..
|
||||
var batch = PIXI.WebGLRenderer.getBatch();
|
||||
batch.init(displayObject);
|
||||
this.batchs.splice(index-1, 0, batch);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// we are 0!
|
||||
var batch = PIXI.WebGLRenderer.getBatch();
|
||||
batch.init(displayObject);
|
||||
this.batchs.splice(0, 0, batch);
|
||||
}
|
||||
|
||||
}
|
||||
else if(displayObject.batch.tail == displayObject)
|
||||
{
|
||||
var currentBatch = displayObject.batch;
|
||||
|
||||
var index = this.batchs.indexOf( currentBatch );
|
||||
var nextBatch = this.batchs[index+1];
|
||||
currentBatch.remove(displayObject);
|
||||
|
||||
if(nextBatch)
|
||||
{
|
||||
if(nextBatch.texture == displayObject.texture.baseTexture && nextBatch.blendMode == displayObject.blendMode)
|
||||
{
|
||||
nextBatch.insertBefore(displayObject, nextBatch.head);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// add it before..
|
||||
var batch = PIXI.WebGLRenderer.getBatch();
|
||||
batch.init(displayObject);
|
||||
this.batchs.splice(index+1, 0, batch);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// we are 0!
|
||||
var batch = PIXI.WebGLRenderer.getBatch();
|
||||
batch.init(displayObject);
|
||||
this.batchs.push(batch);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// console.log("MIDDLE")
|
||||
var currentBatch = displayObject.batch;
|
||||
|
||||
// split the batch into 2
|
||||
// AH! dont split on the current display object as the texture is wrong!
|
||||
var splitBatch = currentBatch.split(displayObject);
|
||||
|
||||
// now remove the display object
|
||||
splitBatch.remove(displayObject);
|
||||
|
||||
var batch = PIXI.WebGLRenderer.getBatch();
|
||||
var index = this.batchs.indexOf( currentBatch );
|
||||
batch.init(displayObject);
|
||||
this.batchs.splice(index+1, 0, batch, splitBatch);
|
||||
}
|
||||
this.insertObject(displayObject, previousRenderable, nextRenderable);
|
||||
}
|
||||
|
||||
PIXI.WebGLRenderGroup.prototype.addDisplayObject = function(displayObject)
|
||||
PIXI.WebGLRenderGroup.prototype.addFilterBlocks = function(start, end)
|
||||
{
|
||||
start.__renderGroup = this;
|
||||
end.__renderGroup = this;
|
||||
/*
|
||||
* LOOK FOR THE PREVIOUS RENDERABLE
|
||||
* This part looks for the closest previous sprite that can go into a batch
|
||||
* It keeps going back until it finds a sprite or the stage
|
||||
*/
|
||||
var previousRenderable = start;
|
||||
while(previousRenderable != this.root)
|
||||
{
|
||||
previousRenderable = previousRenderable._iPrev;
|
||||
if(previousRenderable.renderable && previousRenderable.__renderGroup)break;
|
||||
}
|
||||
this.insertAfter(start, previousRenderable);
|
||||
|
||||
/*
|
||||
* LOOK FOR THE NEXT SPRITE
|
||||
* This part looks for the closest next sprite that can go into a batch
|
||||
* it keeps looking until it finds a sprite or gets to the end of the display
|
||||
* scene graph
|
||||
*/
|
||||
var previousRenderable2 = end;
|
||||
while(previousRenderable2 != this.root)
|
||||
{
|
||||
previousRenderable2 = previousRenderable2._iPrev;
|
||||
if(previousRenderable2.renderable && previousRenderable2.__renderGroup)break;
|
||||
}
|
||||
this.insertAfter(end, previousRenderable2);
|
||||
}
|
||||
|
||||
PIXI.WebGLRenderGroup.prototype.removeFilterBlocks = function(start, end)
|
||||
{
|
||||
this.removeObject(start);
|
||||
this.removeObject(end);
|
||||
}
|
||||
|
||||
PIXI.WebGLRenderGroup.prototype.addDisplayObjectAndChildren = function(displayObject)
|
||||
{
|
||||
// add a child to the render group..
|
||||
if(displayObject.__renderGroup)displayObject.__renderGroup.removeDisplayObjectAndChildren(displayObject);
|
||||
|
||||
// DONT htink this is needed?
|
||||
// displayObject.batch = null;
|
||||
|
||||
displayObject.__renderGroup = this;
|
||||
/*
|
||||
* LOOK FOR THE PREVIOUS RENDERABLE
|
||||
* This part looks for the closest previous sprite that can go into a batch
|
||||
* It keeps going back until it finds a sprite or the stage
|
||||
*/
|
||||
|
||||
var previousRenderable = displayObject.first;
|
||||
while(previousRenderable != this.root)
|
||||
{
|
||||
previousRenderable = previousRenderable._iPrev;
|
||||
if(previousRenderable.renderable && previousRenderable.__renderGroup)break;
|
||||
}
|
||||
|
||||
/*
|
||||
* LOOK FOR THE NEXT SPRITE
|
||||
* This part looks for the closest next sprite that can go into a batch
|
||||
* it keeps looking until it finds a sprite or gets to the end of the display
|
||||
* scene graph
|
||||
*/
|
||||
var nextRenderable = displayObject.last;
|
||||
while(nextRenderable._iNext)
|
||||
{
|
||||
nextRenderable = nextRenderable._iNext;
|
||||
if(nextRenderable.renderable && nextRenderable.__renderGroup)break;
|
||||
}
|
||||
|
||||
// one the display object hits this. we can break the loop
|
||||
|
||||
var tempObject = displayObject.first;
|
||||
var testObject = displayObject.last._iNext;
|
||||
do
|
||||
{
|
||||
tempObject.__renderGroup = this;
|
||||
|
||||
if(tempObject.renderable)
|
||||
{
|
||||
|
||||
this.insertObject(tempObject, previousRenderable, nextRenderable);
|
||||
previousRenderable = tempObject;
|
||||
}
|
||||
|
||||
tempObject = tempObject._iNext;
|
||||
}
|
||||
while(tempObject != testObject)
|
||||
}
|
||||
|
||||
//displayObject.cacheVisible = true;
|
||||
if(!displayObject.renderable)return;
|
||||
PIXI.WebGLRenderGroup.prototype.removeDisplayObjectAndChildren = function(displayObject)
|
||||
{
|
||||
if(displayObject.__renderGroup != this)return;
|
||||
|
||||
// var displayObject = displayObject.first;
|
||||
var lastObject = displayObject.last;
|
||||
do
|
||||
{
|
||||
displayObject.__renderGroup = null;
|
||||
if(displayObject.renderable)this.removeObject(displayObject);
|
||||
displayObject = displayObject._iNext;
|
||||
}
|
||||
while(displayObject)
|
||||
}
|
||||
|
||||
|
||||
|
||||
PIXI.WebGLRenderGroup.prototype.insertObject = function(displayObject, previousObject, nextObject)
|
||||
{
|
||||
// while looping below THE OBJECT MAY NOT HAVE BEEN ADDED
|
||||
//displayObject.__inWebGL = true;
|
||||
var previousSprite = previousObject;
|
||||
var nextSprite = nextObject;
|
||||
|
||||
var previousSprite = this.getPreviousRenderable(displayObject);
|
||||
var nextSprite = this.getNextRenderable(displayObject);
|
||||
|
||||
/*
|
||||
* so now we have the next renderable and the previous renderable
|
||||
*
|
||||
|
@ -612,6 +694,7 @@ PIXI.WebGLRenderGroup.prototype.addDisplayObject = function(displayObject)
|
|||
else
|
||||
{
|
||||
// TODO re-word!
|
||||
|
||||
nextBatch = nextSprite;
|
||||
}
|
||||
}
|
||||
|
@ -634,49 +717,88 @@ PIXI.WebGLRenderGroup.prototype.addDisplayObject = function(displayObject)
|
|||
{
|
||||
this.batchs.push(batch);
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
else if(displayObject instanceof PIXI.TilingSprite)
|
||||
{
|
||||
|
||||
// add to a batch!!
|
||||
this.initTilingSprite(displayObject);
|
||||
this.batchs.push(displayObject);
|
||||
// this.batchs.push(displayObject);
|
||||
|
||||
}
|
||||
else if(displayObject instanceof PIXI.Strip)
|
||||
{
|
||||
// add to a batch!!
|
||||
this.initStrip(displayObject);
|
||||
this.batchs.push(displayObject);
|
||||
// this.batchs.push(displayObject);
|
||||
}
|
||||
else if(displayObject instanceof PIXI.Graphics)
|
||||
else if(displayObject)// instanceof PIXI.Graphics)
|
||||
{
|
||||
//displayObject.initWebGL(this);
|
||||
|
||||
// add to a batch!!
|
||||
//this.initStrip(displayObject);
|
||||
this.batchs.push(displayObject);
|
||||
//this.batchs.push(displayObject);
|
||||
}
|
||||
|
||||
// if its somthing else... then custom codes!
|
||||
this.batchUpdate = true;
|
||||
this.insertAfter(displayObject, previousSprite);
|
||||
|
||||
// insert and SPLIT!
|
||||
|
||||
}
|
||||
|
||||
PIXI.WebGLRenderGroup.prototype.addDisplayObjectAndChildren = function(displayObject)
|
||||
|
||||
|
||||
PIXI.WebGLRenderGroup.prototype.insertAfter = function(item, displayObject)
|
||||
{
|
||||
// TODO - this can be faster - but not as important right now
|
||||
|
||||
this.addDisplayObject(displayObject);
|
||||
var children = displayObject.children;
|
||||
|
||||
for (var i=0; i < children.length; i++)
|
||||
if(displayObject instanceof PIXI.Sprite)
|
||||
{
|
||||
this.addDisplayObjectAndChildren(children[i]);
|
||||
};
|
||||
var previousBatch = displayObject.batch;
|
||||
|
||||
if(previousBatch)
|
||||
{
|
||||
// so this object is in a batch!
|
||||
|
||||
// is it not? need to split the batch
|
||||
if(previousBatch.tail == displayObject)
|
||||
{
|
||||
// is it tail? insert in to batchs
|
||||
var index = this.batchs.indexOf( previousBatch );
|
||||
this.batchs.splice(index+1, 0, item);
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO MODIFY ADD / REMOVE CHILD TO ACCOUNT FOR FILTERS (also get prev and next) //
|
||||
|
||||
// THERE IS A SPLIT IN THIS BATCH! //
|
||||
var splitBatch = previousBatch.split(displayObject.__next);
|
||||
|
||||
// COOL!
|
||||
// add it back into the array
|
||||
/*
|
||||
* OOPS!
|
||||
* seems the new sprite is in the middle of a batch
|
||||
* lets split it..
|
||||
*/
|
||||
var index = this.batchs.indexOf( previousBatch );
|
||||
this.batchs.splice(index+1, 0, item, splitBatch);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.batchs.push(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var index = this.batchs.indexOf( displayObject );
|
||||
this.batchs.splice(index+1, 0, item);
|
||||
}
|
||||
}
|
||||
|
||||
PIXI.WebGLRenderGroup.prototype.removeDisplayObject = function(displayObject)
|
||||
PIXI.WebGLRenderGroup.prototype.removeObject = function(displayObject)
|
||||
{
|
||||
// loop through children..
|
||||
// display object //
|
||||
|
@ -684,10 +806,7 @@ PIXI.WebGLRenderGroup.prototype.removeDisplayObject = function(displayObject)
|
|||
// add a child from the render group..
|
||||
// remove it and all its children!
|
||||
//displayObject.cacheVisible = false;//displayObject.visible;
|
||||
displayObject.__renderGroup = null;
|
||||
|
||||
if(!displayObject.renderable)return;
|
||||
|
||||
|
||||
/*
|
||||
* removing is a lot quicker..
|
||||
*
|
||||
|
@ -745,111 +864,18 @@ PIXI.WebGLRenderGroup.prototype.removeDisplayObject = function(displayObject)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
this.batchs.splice(index, 1);
|
||||
if(batchToRemove instanceof PIXI.WebGLBatch)PIXI.WebGLRenderer.returnBatch(batchToRemove);
|
||||
}
|
||||
}
|
||||
|
||||
PIXI.WebGLRenderGroup.prototype.removeDisplayObjectAndChildren = function(displayObject)
|
||||
{
|
||||
// TODO - this can be faster - but not as important right now
|
||||
if(displayObject.__renderGroup != this)return;
|
||||
|
||||
this.removeDisplayObject(displayObject);
|
||||
var children = displayObject.children;
|
||||
|
||||
for (var i=0; i < children.length; i++)
|
||||
{
|
||||
this.removeDisplayObjectAndChildren(children[i]);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
|
||||
PIXI.WebGLRenderGroup.prototype.getNextRenderable = function(displayObject)
|
||||
{
|
||||
/*
|
||||
* LOOK FOR THE NEXT SPRITE
|
||||
* This part looks for the closest next sprite that can go into a batch
|
||||
* it keeps looking until it finds a sprite or gets to the end of the display
|
||||
* scene graph
|
||||
*
|
||||
* These look a lot scarier than the actually are...
|
||||
*/
|
||||
|
||||
var nextSprite = displayObject;
|
||||
do
|
||||
{
|
||||
// moving forward!
|
||||
// if it has no children..
|
||||
if(nextSprite.children.length == 0)
|
||||
{
|
||||
//maynot have a parent
|
||||
if(!nextSprite.parent)return null;
|
||||
|
||||
// go along to the parent..
|
||||
while(nextSprite.childIndex == nextSprite.parent.children.length-1)
|
||||
{
|
||||
nextSprite = nextSprite.parent;
|
||||
//console.log(">" + nextSprite);
|
||||
// console.log(">-" + this.root);
|
||||
if(nextSprite == this.root || !nextSprite.parent)//displayObject.stage)
|
||||
{
|
||||
nextSprite = null
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(nextSprite)nextSprite = nextSprite.parent.children[nextSprite.childIndex+1];
|
||||
}
|
||||
else
|
||||
{
|
||||
nextSprite = nextSprite.children[0];
|
||||
}
|
||||
|
||||
if(!nextSprite)break;
|
||||
}
|
||||
while(!nextSprite.renderable || !nextSprite.__renderGroup)
|
||||
|
||||
return nextSprite;
|
||||
}
|
||||
|
||||
PIXI.WebGLRenderGroup.prototype.getPreviousRenderable = function(displayObject)
|
||||
{
|
||||
/*
|
||||
* LOOK FOR THE PREVIOUS SPRITE
|
||||
* This part looks for the closest previous sprite that can go into a batch
|
||||
* It keeps going back until it finds a sprite or the stage
|
||||
*/
|
||||
var previousSprite = displayObject;
|
||||
do
|
||||
{
|
||||
if(previousSprite.childIndex == 0)
|
||||
{
|
||||
previousSprite = previousSprite.parent;
|
||||
if(!previousSprite)return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
previousSprite = previousSprite.parent.children[previousSprite.childIndex-1];
|
||||
// what if the bloop has children???
|
||||
while(previousSprite.children.length != 0)
|
||||
{
|
||||
// keep diggin till we get to the last child
|
||||
previousSprite = previousSprite.children[previousSprite.children.length-1];
|
||||
}
|
||||
}
|
||||
|
||||
if(previousSprite == this.root)break;
|
||||
}
|
||||
while(!previousSprite.renderable || !previousSprite.__renderGroup);
|
||||
|
||||
return previousSprite;
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
|
@ -930,7 +956,7 @@ PIXI.WebGLRenderGroup.prototype.renderStrip = function(strip, projection)
|
|||
gl.uniform2f(PIXI.stripShaderProgram.projectionVector, projection.x, projection.y);
|
||||
gl.uniform1f(PIXI.stripShaderProgram.alpha, strip.worldAlpha);
|
||||
|
||||
|
||||
/*
|
||||
if(strip.blendMode == PIXI.blendModes.NORMAL)
|
||||
{
|
||||
gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA);
|
||||
|
@ -939,7 +965,7 @@ PIXI.WebGLRenderGroup.prototype.renderStrip = function(strip, projection)
|
|||
{
|
||||
gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_COLOR);
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
if(!strip.dirty)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue