mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
Lighting: Polar Coordinates fix: Sparkle-Be-Gone (#1345)
This commit is contained in:
@@ -729,6 +729,20 @@ namespace Robust.Client.Console.Commands
|
||||
}
|
||||
}
|
||||
|
||||
internal class ToggleHardFOV : IConsoleCommand
|
||||
{
|
||||
public string Command => "togglehardfov";
|
||||
public string Description => "Toggles hard fov for client (for debugging space-station-14#2353).";
|
||||
public string Help => "togglehardfov";
|
||||
|
||||
public bool Execute(IDebugConsole console, params string[] args)
|
||||
{
|
||||
var mgr = IoCManager.Resolve<ILightManager>();
|
||||
mgr.DrawHardFov = !mgr.DrawHardFov;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
internal class ToggleShadows : IConsoleCommand
|
||||
{
|
||||
public string Command => "toggleshadows";
|
||||
|
||||
@@ -297,7 +297,7 @@ namespace Robust.Client.Graphics.Clyde
|
||||
|
||||
RenderOverlays(OverlaySpace.WorldSpace);
|
||||
|
||||
if (_lightManager.Enabled && eye.DrawFov)
|
||||
if (_lightManager.Enabled && _lightManager.DrawHardFov && eye.DrawFov)
|
||||
{
|
||||
ApplyFovToBuffer(viewport, eye);
|
||||
}
|
||||
|
||||
@@ -25,6 +25,12 @@ uniform float shadowOverlapSide;
|
||||
// also deal with the reference to it in shadow_cast_shared
|
||||
const highp float PI = 3.1415926535897932384626433;
|
||||
|
||||
// expands wall edges a little to prevent holes
|
||||
const highp float DEPTH_LEFTRIGHT_EXPAND_BIAS = 0.001;
|
||||
// added to zbufferDepth BEFORE divide
|
||||
// really just keep at 1.0 (keeps it away from the near clipping plane)
|
||||
const highp float DEPTH_ZBUFFER_PREDIV_BIAS = 1.0;
|
||||
|
||||
void main()
|
||||
{
|
||||
// aPos is clockwise, but we need anticlockwise so swap it here
|
||||
@@ -33,6 +39,11 @@ void main()
|
||||
float xA = atan(pA.y, -pA.x);
|
||||
float xB = atan(pB.y, -pB.x);
|
||||
|
||||
// expand bias
|
||||
float lrSignBias = sign(xB - xA) * DEPTH_LEFTRIGHT_EXPAND_BIAS;
|
||||
xA -= lrSignBias;
|
||||
xB += lrSignBias;
|
||||
|
||||
// We need to reliably detect a clip, as opposed to, say, a backdrawn face.
|
||||
// So a clip is when the angular area is >= 180 degrees (which is not possible with a quad and always occurs when wrapping)
|
||||
if (abs(xA - xB) >= PI)
|
||||
@@ -66,7 +77,7 @@ void main()
|
||||
// because GLES SL 1.00 doesn't have gl_FragDepth.
|
||||
// Keep in mind: Ultimately, this doesn't matter, because we use the colour buffer for actual casting,
|
||||
// and we don't really need to have correction
|
||||
float depth = 1.0 - (1.0 / length(mix(pA, pB, subVertex.x)));
|
||||
float zbufferDepth = 1.0 - (1.0 / (length(mix(pA, pB, subVertex.x)) + DEPTH_ZBUFFER_PREDIV_BIAS));
|
||||
|
||||
gl_Position = vec4(mix(xA, xB, subVertex.x) / PI, mix(1.0, -1.0, subVertex.y), depth, 1.0);
|
||||
gl_Position = vec4(mix(xA, xB, subVertex.x) / PI, mix(1.0, -1.0, subVertex.y), zbufferDepth, 1.0);
|
||||
}
|
||||
|
||||
@@ -6,5 +6,6 @@ namespace Robust.Client.Graphics.Lighting
|
||||
{
|
||||
public bool Enabled { get; set; } = true;
|
||||
public bool DrawShadows { get; set; } = true;
|
||||
public bool DrawHardFov { get; set; } = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,5 +4,6 @@
|
||||
{
|
||||
bool Enabled { get; set; }
|
||||
bool DrawShadows { get; set; }
|
||||
bool DrawHardFov { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user