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)
|
||||
{
|
||||
var items = previews.SelectMany(p => p.Render(worldRenderer, centerPosition));
|
||||
if (Selected)
|
||||
{
|
||||
var overlay = items.Where(r => !r.IsDecoration && r is IModifyableRenderable)
|
||||
.Select(r =>
|
||||
foreach (var p in previews)
|
||||
{
|
||||
foreach (var r in p.Render(worldRenderer, centerPosition))
|
||||
{
|
||||
var mr = (IModifyableRenderable)r;
|
||||
return mr.WithTint(float3.Ones, mr.TintModifiers | TintModifiers.ReplaceColor).WithAlpha(0.5f);
|
||||
});
|
||||
|
||||
return items.Concat(overlay);
|
||||
yield return r;
|
||||
if (!r.IsDecoration && r is IModifyableRenderable mr)
|
||||
yield return mr.WithTint(float3.Ones, mr.TintModifiers | TintModifiers.ReplaceColor)
|
||||
.WithAlpha(0.5f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return items;
|
||||
else
|
||||
foreach (var p in previews)
|
||||
foreach (var r in p.Render(worldRenderer, centerPosition))
|
||||
yield return r;
|
||||
}
|
||||
|
||||
public IEnumerable<IRenderable> RenderAnnotations()
|
||||
|
||||
Reference in New Issue
Block a user