Let viewport clear when eye is missing (#6379)

* Adds option to viewport to allow render target clearing if eye is missing

* on->when and add to IClydeViewport

* add to ClydeHeadless
This commit is contained in:
Richard Van Tassel
2026-01-18 15:17:31 -05:00
committed by GitHub
parent c20343601d
commit 93d14d55c7
4 changed files with 10 additions and 0 deletions

View File

@@ -493,6 +493,9 @@ namespace Robust.Client.Graphics.Clyde
{
if (viewport.Eye == null || viewport.Eye.Position.MapId == MapId.Nullspace)
{
if (viewport.ClearWhenMissingEye)
RenderInRenderTarget(viewport.RenderTarget, () => { }, viewport.ClearColor);
return;
}

View File

@@ -138,6 +138,7 @@ namespace Robust.Client.Graphics.Clyde
public Vector2i Size { get; set; }
public event Action<ClearCachedViewportResourcesEvent>? ClearCachedResources;
public Color? ClearColor { get; set; } = Color.Black;
public bool ClearWhenMissingEye { get; set; }
public Vector2 RenderScale { get; set; } = Vector2.One;
public bool AutomaticRender { get; set; }
public long Id { get; }

View File

@@ -524,6 +524,7 @@ namespace Robust.Client.Graphics.Clyde
public Vector2i Size { get; }
public event Action<ClearCachedViewportResourcesEvent>? ClearCachedResources;
public Color? ClearColor { get; set; } = Color.Black;
public bool ClearWhenMissingEye { get; set; }
public Vector2 RenderScale { get; set; }
public bool AutomaticRender { get; set; }

View File

@@ -43,6 +43,11 @@ namespace Robust.Client.Graphics
/// </summary>
Color? ClearColor { get; set; }
/// <summary>
/// On frames where Eye is null or in nullspace, whether the viewport may clear.
/// </summary>
bool ClearWhenMissingEye { get; set; }
/// <summary>
/// This is, effectively, a multiplier to the eye's zoom.
/// </summary>