2018-02-23 03:44:22 +00:00
|
|
|
var RenderTextureWebGL = {
|
|
|
|
|
2018-02-23 17:09:27 +00:00
|
|
|
fill: function (rgb)
|
2018-02-23 03:44:22 +00:00
|
|
|
{
|
2018-02-23 17:09:27 +00:00
|
|
|
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.clear(gl.COLOR_BUFFER_BIT);
|
|
|
|
this.renderer.setFramebuffer(null);
|
2018-02-23 03:44:22 +00:00
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
|
|
|
clear: function ()
|
|
|
|
{
|
|
|
|
this.renderer.setFramebuffer(this.framebuffer);
|
|
|
|
var gl = this.gl;
|
|
|
|
gl.clearColor(0, 0, 0, 0);
|
|
|
|
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
|
|
this.renderer.setFramebuffer(null);
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-24 00:05:15 +00:00
|
|
|
draw: function (texture, frame, x, y)
|
2018-02-23 03:44:22 +00:00
|
|
|
{
|
2018-02-24 00:05:15 +00:00
|
|
|
var glTexture = texture.source[frame.sourceIndex].glTexture;
|
2018-02-23 03:44:22 +00:00
|
|
|
this.renderer.setFramebuffer(this.framebuffer);
|
2018-02-24 00:05:15 +00:00
|
|
|
this.renderer.pipelines.TextureTintPipeline.drawTexture(glTexture, x, y, frame.x, frame.y, frame.width, frame.height, this.currentMatrix);
|
2018-02-23 03:44:22 +00:00
|
|
|
this.renderer.setFramebuffer(null);
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = RenderTextureWebGL;
|