Stream previews, reduce casting
This commit is contained in:
committed by
Matthias Mailänder
parent
bb0a39ba6c
commit
cc9fa4b3ef
@@ -147,20 +147,23 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public IEnumerable<IRenderable> RenderAt(WPos centerPosition)
|
public IEnumerable<IRenderable> RenderAt(WPos centerPosition)
|
||||||
{
|
{
|
||||||
var items = previews.SelectMany(p => p.Render(worldRenderer, centerPosition));
|
|
||||||
if (Selected)
|
if (Selected)
|
||||||
{
|
{
|
||||||
var overlay = items.Where(r => !r.IsDecoration && r is IModifyableRenderable)
|
foreach (var p in previews)
|
||||||
.Select(r =>
|
{
|
||||||
|
foreach (var r in p.Render(worldRenderer, centerPosition))
|
||||||
{
|
{
|
||||||
var mr = (IModifyableRenderable)r;
|
yield return r;
|
||||||
return mr.WithTint(float3.Ones, mr.TintModifiers | TintModifiers.ReplaceColor).WithAlpha(0.5f);
|
if (!r.IsDecoration && r is IModifyableRenderable mr)
|
||||||
});
|
yield return mr.WithTint(float3.Ones, mr.TintModifiers | TintModifiers.ReplaceColor)
|
||||||
|
.WithAlpha(0.5f);
|
||||||
return items.Concat(overlay);
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
return items;
|
foreach (var p in previews)
|
||||||
|
foreach (var r in p.Render(worldRenderer, centerPosition))
|
||||||
|
yield return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<IRenderable> RenderAnnotations()
|
public IEnumerable<IRenderable> RenderAnnotations()
|
||||||
|
|||||||
Reference in New Issue
Block a user