forked from phaserjs/phaser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTilemapWebGLRenderer.js
More file actions
38 lines (34 loc) · 1.16 KB
/
Copy pathTilemapWebGLRenderer.js
File metadata and controls
38 lines (34 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
var TilemapWebGLRenderer = function (renderer, gameObject, interpolationPercentage, camera)
{
if (this.renderMask !== this.renderFlags)
{
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;