2016-11-14 23:38:41 +00:00
|
|
|
Phaser.Renderer.WebGL.GameObjects.Blitter = {
|
|
|
|
|
|
|
|
TYPES: [
|
|
|
|
Phaser.GameObject.Blitter.prototype
|
|
|
|
],
|
|
|
|
|
2016-11-15 01:57:42 +00:00
|
|
|
render: function (renderer, src, interpolationPercentage)
|
2016-11-14 23:38:41 +00:00
|
|
|
{
|
2016-11-15 01:57:42 +00:00
|
|
|
var blitterAlpha = src.color.worldAlpha * 255 << 24;
|
2016-11-14 23:38:41 +00:00
|
|
|
|
|
|
|
// Skip rendering?
|
2016-11-15 01:57:42 +00:00
|
|
|
if (src.skipRender || !src.visible || blitterAlpha === 0 || src.children.list.length === 0)
|
2016-11-14 23:38:41 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2016-11-15 01:57:42 +00:00
|
|
|
|
|
|
|
var bg = src.color._glBg;
|
|
|
|
var tint = src.color._glTint;
|
|
|
|
var worldAlpha = src.color._worldAlpha;
|
2016-11-14 23:38:41 +00:00
|
|
|
|
|
|
|
// Render children
|
2016-11-15 01:57:42 +00:00
|
|
|
for (var i = 0; i < src.children.list.length; i++)
|
|
|
|
{
|
|
|
|
var bob = src.children.list[i];
|
|
|
|
var frame = bob.frame;
|
|
|
|
var alpha = (worldAlpha * bob.alpha) * 255 << 24;
|
2016-11-14 23:38:41 +00:00
|
|
|
|
2016-11-15 01:57:42 +00:00
|
|
|
if (!bob.visible || alpha === 0 || !frame.cutWidth || !frame.cutHeight)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
2016-11-14 23:38:41 +00:00
|
|
|
|
2016-11-15 01:57:42 +00:00
|
|
|
var index = frame.source.glTextureIndex;
|
|
|
|
var verts = bob.transform.getVertexData(interpolationPercentage);
|
|
|
|
|
|
|
|
// tint and bg values come from the parent Blitter object, not the Bob
|
|
|
|
renderer.batch.add(frame.source, src.blendMode, verts, frame.uvs, index, alpha, tint, bg);
|
|
|
|
}
|
2016-11-14 23:38:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
};
|