Use CellLayer for terrain.

This commit is contained in:
Paul Chote
2014-05-17 02:25:49 +12:00
parent ad730a44c3
commit 997216aef0
12 changed files with 93 additions and 79 deletions

View File

@@ -28,15 +28,12 @@ namespace OpenRA.Graphics
var vertices = new Vertex[4 * map.Bounds.Height * map.Bounds.Width];
var nv = 0;
for (var j = map.Bounds.Top; j < map.Bounds.Bottom; j++)
foreach (var cell in map.Cells)
{
for (var i = map.Bounds.Left; i < map.Bounds.Right; i++)
{
var tile = wr.Theater.TileSprite(map.MapTiles.Value[i, j]);
var pos = wr.ScreenPosition(new CPos(i, j).CenterPosition) - 0.5f * tile.size;
Util.FastCreateQuad(vertices, pos, tile, terrainPalette, nv, tile.size);
nv += 4;
}
var tile = wr.Theater.TileSprite(map.MapTiles.Value[cell]);
var pos = wr.ScreenPosition(cell.CenterPosition) - 0.5f * tile.size;
Util.FastCreateQuad(vertices, pos, tile, terrainPalette, nv, tile.size);
nv += 4;
}
vertexBuffer = Game.Renderer.Device.CreateVertexBuffer(vertices.Length);