2017-09-12 23:58:25 +00:00
|
|
|
var GameObject = require('../../GameObject');
|
2018-01-24 00:40:20 +00:00
|
|
|
var Utils = require('../../../renderer/webgl/Utils');
|
2017-09-12 23:58:25 +00:00
|
|
|
|
2018-01-24 00:40:20 +00:00
|
|
|
var TextWebGLRenderer = function (renderer, text, interpolationPercentage, camera)
|
2017-03-15 01:07:58 +00:00
|
|
|
{
|
2018-01-24 00:40:20 +00:00
|
|
|
if (GameObject.RENDER_MASK !== text.renderFlags || (text.cameraFilter > 0 && (text.cameraFilter & camera._id)) || text.text === '')
|
2017-03-15 01:07:58 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-01-24 00:40:20 +00:00
|
|
|
if (text.dirty)
|
2017-03-21 21:06:36 +00:00
|
|
|
{
|
2018-01-24 00:40:20 +00:00
|
|
|
text.canvasTexture = renderer.canvasToTexture(text.canvas, text.canvasTexture, true, text.scaleMode);
|
|
|
|
text.dirty = false;
|
2017-03-21 21:06:36 +00:00
|
|
|
}
|
2018-01-24 00:40:20 +00:00
|
|
|
|
|
|
|
var getTint = Utils.getTintAppendFloatAlpha;
|
|
|
|
|
2018-01-29 21:46:48 +00:00
|
|
|
this.pipeline.batchTexture(
|
2018-01-24 00:40:20 +00:00
|
|
|
text.canvasTexture,
|
2018-01-25 00:15:51 +00:00
|
|
|
text.canvasTexture.width, text.canvasTexture.height,
|
2018-01-24 00:40:20 +00:00
|
|
|
text.x, text.y,
|
2018-01-24 22:29:57 +00:00
|
|
|
text.canvasTexture.width, text.canvasTexture.height,
|
2018-01-24 00:40:20 +00:00
|
|
|
text.scaleX, text.scaleY,
|
|
|
|
text.rotation,
|
|
|
|
text.flipX, text.flipY,
|
|
|
|
text.scrollFactorX, text.scrollFactorY,
|
|
|
|
text.displayOriginX, text.displayOriginY,
|
|
|
|
0, 0, text.canvasTexture.width, text.canvasTexture.height,
|
|
|
|
getTint(text._tintTL, text._alphaTL),
|
|
|
|
getTint(text._tintTR, text._alphaTR),
|
|
|
|
getTint(text._tintBL, text._alphaBL),
|
|
|
|
getTint(text._tintBR, text._alphaBR),
|
2018-01-25 00:15:51 +00:00
|
|
|
0, 0,
|
2018-01-24 00:40:20 +00:00
|
|
|
camera
|
|
|
|
);
|
2017-03-15 01:07:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = TextWebGLRenderer;
|