Add a debug visualization for screen map rectangles.

This commit is contained in:
Paul Chote
2017-12-03 23:06:48 +00:00
committed by reaperrr
parent 0f512088d2
commit 9d2935935c
9 changed files with 59 additions and 1 deletions

View File

@@ -212,6 +212,13 @@ namespace OpenRA.Graphics
r.RenderDebugGeometry(this);
}
if (debugVis.Value != null && debugVis.Value.ScreenMap)
foreach (var r in World.ScreenMap.ItemBounds(World.RenderPlayer))
Game.Renderer.WorldRgbaColorRenderer.DrawRect(
new float3(r.Left, r.Top, r.Bottom),
new float3(r.Right, r.Bottom, r.Bottom),
1 / Viewport.Zoom, Color.MediumSpringGreen);
Game.Renderer.Flush();
}

View File

@@ -133,5 +133,7 @@ namespace OpenRA.Primitives
}
}
}
public IEnumerable<Rectangle> ItemBounds { get { return itemBounds.Values; } }
}
}

View File

@@ -18,6 +18,7 @@ namespace OpenRA.Traits
{
public bool CombatGeometry;
public bool RenderGeometry;
public bool ScreenMap;
public bool DepthBuffer;
public bool ActorTags;
}

View File

@@ -187,5 +187,13 @@ namespace OpenRA.Traits
return NoFrozenActors;
return partitionedFrozenActors[p].InBox(r).Where(frozenActorIsValid);
}
public IEnumerable<Rectangle> ItemBounds(Player viewer)
{
var bounds = partitionedActors.ItemBounds
.Concat(partitionedEffects.ItemBounds);
return viewer != null ? bounds.Concat(partitionedFrozenActors[viewer].ItemBounds) : bounds;
}
}
}