mirror of
https://github.com/photonstorm/phaser
synced 2024-11-16 01:38:23 +00:00
Added new method
This commit is contained in:
parent
3c54c852dc
commit
a2d5f25a55
1 changed files with 29 additions and 21 deletions
|
@ -389,7 +389,6 @@ var WebGLPipeline = new Class({
|
|||
this.batch = [];
|
||||
this.currentBatch = null;
|
||||
this.currentTexture = null;
|
||||
|
||||
},
|
||||
|
||||
createBatch: function (texture)
|
||||
|
@ -410,6 +409,18 @@ var WebGLPipeline = new Class({
|
|||
return 0;
|
||||
},
|
||||
|
||||
addTextureToBatch: function (texture)
|
||||
{
|
||||
var batch = this.currentBatch;
|
||||
|
||||
if (batch)
|
||||
{
|
||||
batch.texture.push(texture);
|
||||
batch.unit++;
|
||||
batch.maxUnit++;
|
||||
}
|
||||
},
|
||||
|
||||
pushBatch: function (texture)
|
||||
{
|
||||
// No current batch? Create one and return
|
||||
|
@ -829,10 +840,6 @@ var WebGLPipeline = new Class({
|
|||
if (frame === undefined) { frame = gameObject.frame; }
|
||||
|
||||
return this.pushBatch(frame.source.glTexture);
|
||||
|
||||
// this.currentUnit = this.renderer.setTextureSource(frame.source);
|
||||
|
||||
// return this.currentUnit;
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -1270,21 +1277,26 @@ var WebGLPipeline = new Class({
|
|||
}
|
||||
}
|
||||
|
||||
this.vertexCount = 0;
|
||||
|
||||
this.batch.length = 0;
|
||||
this.currentBatch = null;
|
||||
this.currentTexture = null;
|
||||
this.currentUnit = 0;
|
||||
|
||||
this.emit(Events.AFTER_FLUSH, this, isPostFlush);
|
||||
|
||||
this.onAfterFlush(isPostFlush);
|
||||
this.resetBatch(isPostFlush);
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
resetBatch: function (isPostFlush)
|
||||
{
|
||||
this.vertexCount = 0;
|
||||
|
||||
this.batch.length = 0;
|
||||
this.currentBatch = null;
|
||||
this.currentTexture = null;
|
||||
this.currentUnit = 0;
|
||||
|
||||
this.emit(Events.AFTER_FLUSH, this, isPostFlush);
|
||||
|
||||
this.onAfterFlush(isPostFlush);
|
||||
},
|
||||
|
||||
/**
|
||||
* By default this is an empty method hook that you can override and use in your own custom pipelines.
|
||||
*
|
||||
|
@ -1751,7 +1763,7 @@ var WebGLPipeline = new Class({
|
|||
*/
|
||||
drawFillRect: function (x, y, width, height, color, alpha, texture, flipUV)
|
||||
{
|
||||
if (texture === undefined) { texture = this.renderer.whiteTexture.glTexture; }
|
||||
if (texture === undefined) { texture = this.renderer.whiteTexture; }
|
||||
if (flipUV === undefined) { flipUV = true; }
|
||||
|
||||
x = Math.floor(x);
|
||||
|
@ -1791,13 +1803,9 @@ var WebGLPipeline = new Class({
|
|||
*/
|
||||
setTexture2D: function (texture)
|
||||
{
|
||||
if (texture === undefined) { texture = this.renderer.whiteTexture.glTexture; }
|
||||
if (texture === undefined) { texture = this.renderer.whiteTexture; }
|
||||
|
||||
return this.pushBatch(texture);
|
||||
|
||||
// this.currentUnit = this.renderer.setTexture2D(texture);
|
||||
|
||||
// return this.currentUnit;
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue