Replace IOrderGenerator.RenderBeforeWorld with world-sorted .Render.

Range circles have been moved to RenderAfterWorld for now.
This commit is contained in:
Paul Chote
2013-08-10 21:28:39 +12:00
parent b02fd0d002
commit 4754cbb768
21 changed files with 86 additions and 67 deletions

View File

@@ -77,8 +77,11 @@ namespace OpenRA.Graphics
bounds.TopLeftAsCPos(),
bounds.BottomRightAsCPos());
var worldRenderables = actors.SelectMany(a => a.Render(this))
.OrderBy(r => r, comparer);
var worldRenderables = actors.SelectMany(a => a.Render(this));
if (world.OrderGenerator != null)
worldRenderables = worldRenderables.Concat(world.OrderGenerator.Render(this, world));
worldRenderables = worldRenderables.OrderBy(r => r, comparer);
// Effects are drawn on top of all actors
// TODO: Allow effects to be interleaved with actors
@@ -112,16 +115,8 @@ namespace OpenRA.Graphics
foreach (var r in a.Trait.RenderAsTerrain(this, a.Actor))
r.Render(this);
foreach (var a in world.Selection.Actors)
if (!a.Destroyed)
foreach (var t in a.TraitsImplementing<IPreRenderSelection>())
t.RenderBeforeWorld(this, a);
Game.Renderer.Flush();
if (world.OrderGenerator != null)
world.OrderGenerator.RenderBeforeWorld(this, world);
for (var i = 0; i < renderables.Count; i++)
renderables[i].Render(this);