Initial Commit
Mitre line algorth working in webGL
This commit is contained in:
parent
60c348bcce
commit
9a806b5720
29 changed files with 8043 additions and 121 deletions
133
bin/pixi.dev.js
133
bin/pixi.dev.js
|
@ -4,7 +4,7 @@
|
|||
* Copyright (c) 2012, Mat Groves
|
||||
* http://goodboydigital.com/
|
||||
*
|
||||
* Compiled: 2013-06-07
|
||||
* Compiled: 2013-06-14
|
||||
*
|
||||
* Pixi.JS is licensed under the MIT License.
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
|
@ -1465,7 +1465,7 @@ PIXI.InteractionManager.prototype.update = function()
|
|||
|
||||
var len = this.interactiveItems.length;
|
||||
|
||||
for (var i=0; i < this.interactiveItems.length; i++) {
|
||||
for (var i=0; i < len; i++) {
|
||||
this.interactiveItems[i].interactiveChildren = false;
|
||||
}
|
||||
|
||||
|
@ -2643,7 +2643,9 @@ PIXI.WebGLRenderer.prototype.render = function(stage)
|
|||
gl.clearColor(stage.backgroundColorSplit[0],stage.backgroundColorSplit[1],stage.backgroundColorSplit[2], !this.transparent);
|
||||
gl.clear(gl.COLOR_BUFFER_BIT);
|
||||
|
||||
|
||||
// HACK TO TEST
|
||||
PIXI.projectionMatrix = this.projectionMatrix;
|
||||
|
||||
this.stageRenderGroup.backgroundColor = stage.backgroundColorSplit;
|
||||
this.stageRenderGroup.render(this.projectionMatrix);
|
||||
|
||||
|
@ -3422,7 +3424,6 @@ PIXI.WebGLRenderGroup.prototype.setRenderable = function(displayObject)
|
|||
|
||||
PIXI.WebGLRenderGroup.prototype.render = function(projectionMatrix)
|
||||
{
|
||||
|
||||
PIXI.WebGLRenderer.updateTextures();
|
||||
|
||||
var gl = this.gl;
|
||||
|
@ -3452,6 +3453,10 @@ PIXI.WebGLRenderGroup.prototype.render = function(projectionMatrix)
|
|||
{
|
||||
if(renderable.visible)this.renderStrip(renderable, projectionMatrix);
|
||||
}
|
||||
else if(renderable instanceof PIXI.Graphics)
|
||||
{
|
||||
if(renderable.visible) renderable.renderWebGL(this, projectionMatrix);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3652,8 +3657,9 @@ PIXI.WebGLRenderGroup.prototype.checkVisibility = function(displayObject, global
|
|||
child.textureChange = false;
|
||||
if(child.worldVisible)
|
||||
{
|
||||
this.removeDisplayObject(child)
|
||||
this.addDisplayObject(child)
|
||||
this.removeDisplayObject(child);
|
||||
this.addDisplayObject(child);
|
||||
//this.updateTexture(child);
|
||||
}
|
||||
// update texture!!
|
||||
}
|
||||
|
@ -3665,6 +3671,106 @@ 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)
|
||||
{
|
||||
// just one! this guy! so simply swap the texture
|
||||
displayObject.batch.texture = displayObject.texture.baseTexture;
|
||||
return;
|
||||
}
|
||||
|
||||
// early out!
|
||||
if(displayObject.batch.texture == displayObject.texture.baseTexture)return;
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
PIXI.WebGLRenderGroup.prototype.addDisplayObject = function(displayObject)
|
||||
{
|
||||
// add a child to the render group..
|
||||
|
@ -3683,19 +3789,16 @@ PIXI.WebGLRenderGroup.prototype.addDisplayObject = function(displayObject)
|
|||
|
||||
var previousSprite = this.getPreviousRenderable(displayObject);
|
||||
var nextSprite = this.getNextRenderable(displayObject);
|
||||
|
||||
|
||||
/*
|
||||
* so now we have the next renderable and the previous renderable
|
||||
*
|
||||
*/
|
||||
|
||||
if(displayObject instanceof PIXI.Sprite)
|
||||
{
|
||||
var previousBatch
|
||||
var nextBatch
|
||||
|
||||
//console.log( previousSprite)
|
||||
if(previousSprite instanceof PIXI.Sprite)
|
||||
{
|
||||
previousBatch = previousSprite.batch;
|
||||
|
@ -3792,6 +3895,14 @@ PIXI.WebGLRenderGroup.prototype.addDisplayObject = function(displayObject)
|
|||
this.initStrip(displayObject);
|
||||
this.batchs.push(displayObject);
|
||||
}
|
||||
else if(displayObject instanceof PIXI.Graphics)
|
||||
{
|
||||
//displayObject.initWebGL(this);
|
||||
|
||||
// add to a batch!!
|
||||
//this.initStrip(displayObject);
|
||||
this.batchs.push(displayObject);
|
||||
}
|
||||
|
||||
// if its somthing else... then custom codes!
|
||||
this.batchUpdate = true;
|
||||
|
@ -4383,6 +4494,10 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
|
|||
{
|
||||
displayObject.renderCanvas(this);
|
||||
}
|
||||
else if(displayObject instanceof PIXI.Graphics)
|
||||
{
|
||||
displayObject.render(this);
|
||||
}
|
||||
|
||||
// render!
|
||||
for (var i=0; i < displayObject.children.length; i++)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue