38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
using Robust.Client.Graphics;
|
|
using Robust.Shared.Enums;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Client._White.Overlays;
|
|
|
|
public sealed class SaturationScaleOverlay : Overlay
|
|
{
|
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
|
|
|
public override bool RequestScreenTexture => true;
|
|
public override OverlaySpace Space => OverlaySpace.WorldSpace;
|
|
private readonly ShaderInstance _shader;
|
|
private const float Saturation = 0.5f;
|
|
|
|
public SaturationScaleOverlay()
|
|
{
|
|
IoCManager.InjectDependencies(this);
|
|
_shader = _prototypeManager.Index<ShaderPrototype>("SaturationScale").InstanceUnique();
|
|
}
|
|
|
|
|
|
protected override void Draw(in OverlayDrawArgs args)
|
|
{
|
|
if (ScreenTexture == null)
|
|
return;
|
|
|
|
_shader.SetParameter("SCREEN_TEXTURE", ScreenTexture);
|
|
_shader.SetParameter("saturation", Saturation);
|
|
|
|
var handle = args.WorldHandle;
|
|
|
|
handle.UseShader(_shader);
|
|
handle.DrawRect(args.WorldBounds, Color.White);
|
|
handle.UseShader(null);
|
|
}
|
|
}
|