Files

39 lines
1021 B
C#
Raw Permalink Normal View History

using Robust.Client.Graphics;
using Robust.Shared.Enums;
using Robust.Shared.Prototypes;
namespace Content.Client._White.Overlays;
public sealed class GrainOverlay : Overlay
{
[Dependency] private readonly IPrototypeManager _prototype = default!;
private readonly ShaderInstance _shader;
public GrainOverlay()
{
IoCManager.InjectDependencies(this);
_shader = _prototype.Index<ShaderPrototype>("Grain").Instance().Duplicate();
}
public override OverlaySpace Space => OverlaySpace.WorldSpace;
public override bool RequestScreenTexture => true;
protected override void Draw(in OverlayDrawArgs args)
{
if (ScreenTexture is null)
return;
var worldHandle = args.WorldHandle;
_shader.SetParameter("SCREEN_TEXTURE", ScreenTexture);
_shader.SetParameter("strength", 40.0f);
worldHandle.UseShader(_shader);
worldHandle.DrawRect(args.WorldBounds, Color.White);
worldHandle.UseShader(null);
}
}