Convert some keys users of CellLayer to index via map-coords for efficiency.

This commit is contained in:
RoosterDragon
2014-12-05 20:55:18 +00:00
parent b728deb0e1
commit c37a691c33
11 changed files with 140 additions and 88 deletions

View File

@@ -182,13 +182,13 @@ namespace OpenRA.Graphics
var stride = bitmapData.Stride / 4;
var shroudObscured = world.ShroudObscuresTest(map.Cells);
var fogObscured = world.FogObscuresTest(map.Cells);
foreach (var cell in map.Cells)
foreach (var uv in map.Cells.MapCoords)
{
var uv = Map.CellToMap(map.TileShape, cell) - offset;
if (shroudObscured(cell))
colors[uv.Y * stride + uv.X] = shroud;
else if (fogObscured(cell))
colors[uv.Y * stride + uv.X] = fog;
var bitmapUv = uv - offset;
if (shroudObscured(uv.X, uv.Y))
colors[bitmapUv.Y * stride + bitmapUv.X] = shroud;
else if (fogObscured(uv.X, uv.Y))
colors[bitmapUv.Y * stride + bitmapUv.X] = fog;
}
}