mirror of
https://github.com/photonstorm/phaser
synced 2024-11-23 13:13:43 +00:00
New pipeline function call
This commit is contained in:
parent
b7edbe755f
commit
ef79edf1ff
1 changed files with 17 additions and 10 deletions
|
@ -1,14 +1,16 @@
|
|||
var RenderTextureWebGL = {
|
||||
|
||||
fill: function (rgb)
|
||||
fill: function (rgb, alpha)
|
||||
{
|
||||
if (alpha === undefined) { alpha = 1; }
|
||||
|
||||
var ur = ((rgb >> 16)|0) & 0xff;
|
||||
var ug = ((rgb >> 8)|0) & 0xff;
|
||||
var ub = (rgb|0) & 0xff;
|
||||
|
||||
this.renderer.setFramebuffer(this.framebuffer);
|
||||
var gl = this.gl;
|
||||
gl.clearColor(ur / 255.0, ug / 255.0, ub / 255.0, 1);
|
||||
gl.clearColor(ur / 255.0, ug / 255.0, ub / 255.0, alpha);
|
||||
gl.clear(gl.COLOR_BUFFER_BIT);
|
||||
this.renderer.setFramebuffer(null);
|
||||
return this;
|
||||
|
@ -24,23 +26,28 @@ var RenderTextureWebGL = {
|
|||
return this;
|
||||
},
|
||||
|
||||
draw: function (texture, frame, x, y)
|
||||
draw: function (texture, frame, x, y, tint)
|
||||
{
|
||||
var glTexture = texture.source[frame.sourceIndex].glTexture;
|
||||
|
||||
var tint = (this.globalTint >> 16) + (this.globalTint & 0xff00) + ((this.globalTint & 0xff) << 16);
|
||||
if (tint === undefined)
|
||||
{
|
||||
tint = (this.globalTint >> 16) + (this.globalTint & 0xff00) + ((this.globalTint & 0xff) << 16);
|
||||
}
|
||||
else
|
||||
{
|
||||
tint = (tint >> 16) + (tint & 0xff00) + ((tint & 0xff) << 16);
|
||||
}
|
||||
|
||||
this.renderer.setFramebuffer(this.framebuffer);
|
||||
|
||||
var ttp = this.renderer.pipelines.TextureTintPipeline;
|
||||
var pipeline = this.pipeline;
|
||||
|
||||
ttp.projOrtho(0, ttp.width, 0, ttp.height, -1000.0, 1000.0);
|
||||
pipeline.projOrtho(0, pipeline.width, 0, pipeline.height, -1000.0, 1000.0);
|
||||
|
||||
ttp.drawTexture(glTexture, x, y, tint, this.globalAlpha, frame.cutX, frame.cutY, frame.cutWidth, frame.cutHeight, this.currentMatrix, null, this);
|
||||
pipeline.drawTextureFrame(frame, x, y, tint, this.globalAlpha, this.currentMatrix, null);
|
||||
|
||||
this.renderer.setFramebuffer(null);
|
||||
|
||||
ttp.projOrtho(0, ttp.width, ttp.height, 0, -1000.0, 1000.0);
|
||||
pipeline.projOrtho(0, pipeline.width, pipeline.height, 0, -1000.0, 1000.0);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue