Added new method

This commit is contained in:
Richard Davey 2022-10-09 17:30:36 +01:00
parent 3c54c852dc
commit a2d5f25a55

View file

@ -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,6 +1277,14 @@ var WebGLPipeline = new Class({
}
}
this.resetBatch(isPostFlush);
}
return this;
},
resetBatch: function (isPostFlush)
{
this.vertexCount = 0;
this.batch.length = 0;
@ -1280,9 +1295,6 @@ var WebGLPipeline = new Class({
this.emit(Events.AFTER_FLUSH, this, isPostFlush);
this.onAfterFlush(isPostFlush);
}
return this;
},
/**
@ -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;
},
/**