mirror of
https://github.com/photonstorm/phaser
synced 2024-12-24 20:13:35 +00:00
38 lines
1.2 KiB
JavaScript
38 lines
1.2 KiB
JavaScript
var TilemapWebGLRenderer = function (renderer, gameObject, interpolationPercentage, camera)
|
|
{
|
|
if (this.renderMask !== this.renderFlags || (gameObject.cameraFilter > 0 && (gameObject.cameraFilter & camera._id)))
|
|
{
|
|
return;
|
|
}
|
|
|
|
this.cull(camera);
|
|
|
|
var renderTiles = gameObject.culledTiles;
|
|
var length = renderTiles.length;
|
|
var batch = renderer.spriteBatch;
|
|
var texture = gameObject.texture.source[0].glTexture;
|
|
var textureWidth = texture.width;
|
|
var textureHeight = texture.height;
|
|
var renderTarget = gameObject.renderTarget;
|
|
var scrollFactorX = gameObject.scrollFactorX;
|
|
var scrollFactorY = gameObject.scrollFactorY;
|
|
var alpha = gameObject.alpha;
|
|
var x = gameObject.x;
|
|
var y = gameObject.y;
|
|
|
|
for (var index = 0; index < length; ++index)
|
|
{
|
|
var tile = renderTiles[index];
|
|
batch.addTileTextureRect(
|
|
texture,
|
|
x + tile.x, y + tile.y, tile.width, tile.height, alpha * tile.alpha, tile.tint,
|
|
scrollFactorX, scrollFactorY,
|
|
textureWidth, textureHeight,
|
|
tile.frameX, tile.frameY, tile.frameWidth, tile.frameHeight,
|
|
camera,
|
|
renderTarget
|
|
);
|
|
}
|
|
};
|
|
|
|
module.exports = TilemapWebGLRenderer;
|