2
0
Fork 0
mirror of https://github.com/photonstorm/phaser synced 2024-12-21 02:23:29 +00:00
phaser/v3/merge/gameobjects/pixelfield/PixelFieldWebGLRenderer.js
2016-11-23 00:17:46 +00:00

33 lines
863 B
JavaScript

Phaser.Renderer.WebGL.GameObjects.PixelField = {
TYPES: [
Phaser.GameObject.PixelField.prototype
],
render: function (renderer, src, interpolationPercentage)
{
var pixel;
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
);
}
}
}
};