Skip to content

Commit 7240c0d

Browse files
YaraaraYfunkystationbot
andauthored
Shaders & Meson fix (funky-station#2322)
* shaders fix & meson fix * chore: Automatically update REUSE headers --------- Co-authored-by: funkystationbot <funky@funkystation.org>
1 parent 029e78c commit 7240c0d

3 files changed

Lines changed: 11 additions & 19 deletions

File tree

Content.Client/Glasses/GlassesOverlaySystem.cs

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// SPDX-FileCopyrightText: 2025 MaiaArai <158123176+YaraaraY@users.noreply.github.com>
12
// SPDX-FileCopyrightText: 2025 YaraaraY <158123176+YaraaraY@users.noreply.github.com>
23
//
34
// SPDX-License-Identifier: AGPL-3.0-or-later
@@ -32,20 +33,7 @@ private void OnHandleState(EntityUid uid, GlassesOverlayComponent component, ref
3233
component.Enabled = state.Enabled;
3334
component.Shader = state.Shader;
3435
component.Color = state.Color;
35-
36-
// DIRECT UPDATE (Bypassing Relay)
37-
// Manually refresh the local provider list
38-
if (component.Enabled)
39-
{
40-
_overlay.Providers.Add(component);
41-
}
42-
else
43-
{
44-
_overlay.Providers.Remove(component);
45-
}
46-
47-
// No explicit Refresh() method needed for GlassesOverlay usually,
48-
// as it checks Providers.Any() in BeforeDraw, but if it has one, call it.
36+
RefreshOverlay();
4937
}
5038

5139
protected override void UpdateInternal(RefreshEquipmentHudEvent<GlassesOverlayComponent> args)
@@ -55,7 +43,6 @@ protected override void UpdateInternal(RefreshEquipmentHudEvent<GlassesOverlayCo
5543
if (!_overlayMan.HasOverlay<GlassesOverlay>())
5644
_overlayMan.AddOverlay(_overlay);
5745

58-
// Note: The original code used a HashSet of components
5946
_overlay.Providers = args.Components.Where(c => c.Enabled).ToHashSet();
6047
}
6148

Resources/Textures/Shaders/goggles.swsl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
uniform sampler2D SCREEN_TEXTURE;
22
uniform lowp vec4 color;
33
uniform lowp int lineCount;
4-
uniform lowp float scanlineIntensity; // 0 - 1
4+
uniform lowp float scanlineIntensity;
55
uniform lowp float alpha;
66
uniform lowp float distortionStrength;
7-
uniform lowp float flicker; // 0 - 1
7+
uniform lowp float flicker;
88
uniform lowp float beamLength;
99
uniform lowp float beamSpeed;
1010

1111
const highp float PI = 3.14159265;
1212

1313
void fragment() {
14+
precision highp float;
15+
1416
highp vec2 uv = FRAGCOORD.xy * SCREEN_PIXEL_SIZE.xy;
1517

1618
highp vec2 center = uv - 0.5;
@@ -28,8 +30,9 @@ void fragment() {
2830
scanline = 1.0 - (scanline * scanlineIntensity);
2931

3032
lowp vec3 finalColor = tinted * scanline;
31-
lowp float flicker = flicker + (1- flicker) * sin(TIME * 50.0); // fuck the us
32-
finalColor *= flicker;
33+
34+
lowp float flickerEffect = flicker + (1.0 - flicker) * sin(TIME * 50.0);
35+
finalColor *= flickerEffect;
3336

3437
lowp float beam = smoothstep(0.0, beamLength, abs(fract(uv.y + TIME * beamSpeed)));
3538
finalColor = mix(finalColor, finalColor * beam * 0.2, beam);

Resources/Textures/Shaders/xray.swsl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ uniform lowp float scanlineSpeed;
66
uniform lowp float alpha;
77

88
void fragment() {
9+
precision highp float;
10+
911
lowp vec4 tex = texture2D(TEXTURE, UV);
1012
tex.a *= alpha;
1113
lowp vec3 base = tex.rgb * color.rgb;

0 commit comments

Comments
 (0)