Introduce a new type for representing map coordinates.
To resolve the ambiguity introduced when the introduction of isometric maps meant that cell and map coordinates were no longer equivalent, a new type has been introduced so they can each be represented separately.
This commit is contained in:
@@ -44,12 +44,11 @@ namespace OpenRA.Graphics
|
||||
{
|
||||
var verticesPerRow = 4 * map.Bounds.Width;
|
||||
var cells = viewport.VisibleCells;
|
||||
var shape = wr.World.Map.TileShape;
|
||||
|
||||
// Only draw the rows that are visible.
|
||||
// VisibleCells is clamped to the map, so additional checks are unnecessary
|
||||
var firstRow = Map.CellToMap(shape, cells.TopLeft).Y - map.Bounds.Top;
|
||||
var lastRow = Map.CellToMap(shape, cells.BottomRight).Y - map.Bounds.Top + 1;
|
||||
var firstRow = cells.TopLeft.ToMPos(map).V - map.Bounds.Top;
|
||||
var lastRow = cells.BottomRight.ToMPos(map).V - map.Bounds.Top + 1;
|
||||
|
||||
Game.Renderer.WorldSpriteRenderer.DrawVertexBuffer(
|
||||
vertexBuffer, verticesPerRow * firstRow, verticesPerRow * (lastRow - firstRow),
|
||||
|
||||
Reference in New Issue
Block a user