mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-14 19:29:36 +01:00
Add a cvar for FOV color (#3741)
This commit is contained in:
@@ -39,7 +39,7 @@ END TEMPLATE-->
|
||||
|
||||
### New features
|
||||
|
||||
*None yet*
|
||||
* The FOV color is now configurable via the "render.fov_color" cvar
|
||||
|
||||
### Bugfixes
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ preset raw;
|
||||
#include "/Shaders/Internal/fov_shared.swsl"
|
||||
|
||||
const highp float g_MinVariance = 0.0;
|
||||
uniform highp vec4 occludeColor;
|
||||
|
||||
void fragment()
|
||||
{
|
||||
@@ -19,5 +20,5 @@ void fragment()
|
||||
discard;
|
||||
}
|
||||
|
||||
COLOR = vec4(0.0, 0.0, 0.0, 1.0 - occlusion);
|
||||
COLOR = vec4(occludeColor.rgb, 1.0 - occlusion);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ preset raw;
|
||||
#include "/Shaders/Internal/fov_shared.swsl"
|
||||
|
||||
const highp float g_MinVariance = 0.0;
|
||||
uniform highp vec4 occludeColor;
|
||||
|
||||
void fragment()
|
||||
{
|
||||
@@ -18,5 +19,5 @@ void fragment()
|
||||
discard;
|
||||
}
|
||||
|
||||
COLOR = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
COLOR = vec4(occludeColor.rgb, 1.0);
|
||||
}
|
||||
|
||||
@@ -813,6 +813,10 @@ namespace Robust.Client.Graphics.Clyde
|
||||
|
||||
fovShader.SetUniformTextureMaybe(UniIMainTexture, TextureUnit.Texture0);
|
||||
|
||||
if (!Color.TryParse(_cfg.GetCVar(CVars.RenderFOVColor), out var color))
|
||||
color = Color.Black;
|
||||
|
||||
fovShader.SetUniformMaybe("occludeColor", color);
|
||||
FovSetTransformAndBlit(viewport, eye.Position.Position, fovShader);
|
||||
|
||||
GL.StencilMask(0x00);
|
||||
@@ -856,6 +860,7 @@ namespace Robust.Client.Graphics.Clyde
|
||||
GL.StencilOp(TKStencilOp.Keep, TKStencilOp.Keep, TKStencilOp.Replace);
|
||||
CheckGlError();
|
||||
|
||||
fovShader.SetUniformMaybe("occludeColor", Color.Black);
|
||||
FovSetTransformAndBlit(viewport, eye.Position.Position, fovShader);
|
||||
|
||||
if (_hasGLSamplerObjects)
|
||||
|
||||
@@ -1912,5 +1912,20 @@ namespace Robust.Shared.Maths
|
||||
{
|
||||
return DefaultColorsInverted.TryGetValue(this, out var name) ? name : null;
|
||||
}
|
||||
|
||||
public static bool TryParse(string input, out Color color)
|
||||
{
|
||||
if (TryFromName(input, out color))
|
||||
return true;
|
||||
|
||||
var nullableColor = TryFromHex(input);
|
||||
if (nullableColor != null)
|
||||
{
|
||||
color = nullableColor.Value;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ using Robust.Shared.Audio;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Physics;
|
||||
|
||||
@@ -718,6 +719,9 @@ namespace Robust.Shared
|
||||
public static readonly CVarDef<double> RenderSpriteDirectionBias =
|
||||
CVarDef.Create("render.sprite_direction_bias", -0.05, CVar.ARCHIVE | CVar.CLIENTONLY);
|
||||
|
||||
public static readonly CVarDef<string> RenderFOVColor =
|
||||
CVarDef.Create("render.fov_color", Color.Black.ToHex(), CVar.ARCHIVE | CVar.CLIENTONLY);
|
||||
|
||||
/*
|
||||
* DISPLAY
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user