phaser/v3/merge/gameobjects/pixelfield/PixelFieldWebGLRenderer.js

34 lines
863 B
JavaScript
Raw Normal View History

Phaser.Renderer.WebGL.GameObjects.PixelField = {
TYPES: [
Phaser.GameObject.PixelField.prototype
],
2016-11-09 15:33:42 +00:00
render: function (renderer, src, interpolationPercentage)
{
var pixel;
2016-11-09 15:33:42 +00:00
var verts = src.transform.getVertexData(interpolationPercentage);
for (var i = 0; i < src.list.length; i++)
{
pixel = src.list[i];
if (pixel.a > 0)
{
renderer.batch.addPixel(
verts.x0 + pixel.x,
verts.y0 + pixel.y,
verts.x1 + pixel.x,
verts.y1 + pixel.y,
verts.x2 + pixel.x,
verts.y2 + pixel.y,
verts.x3 + pixel.x,
verts.y3 + pixel.y,
pixel.color
);
}
}
}
};