Skip to content

Commit e0ae49f

Browse files
authored
Add files via upload
1 parent 03ea551 commit e0ae49f

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

LuaRules/Gadgets/Shaders/gfx_overdrive_cables.frag.glsl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ uniform float losViewEnabled; // 1.0 = LOS overlay is on (GetMapDrawMode=="los")
1515

1616
// Same SSBO as the GS — per-edge coverage bitmask, gates per-segment
1717
// ghost rendering for enemy fragments.
18+
#if !defined(SHADOW_PASS) && !defined(DEFERRED_PASS)
1819
layout (std430, binding = 6) coherent buffer cableCoverageBuffer {
1920
uvec4 cableCoverage[];
2021
};
22+
#endif
2123

2224
in DataGS {
2325
vec3 worldPos;
@@ -350,6 +352,7 @@ void main() {
350352
vec2 losUV0 = clamp(worldPos.xz, vec2(0.0), mapSize.xy) / mapSize.zw;
351353
float los0 = texture(infoTex, losUV0).r;
352354
if (los0 >= ENEMY_LOS_CUT) discard;
355+
#if !defined(SHADOW_PASS) && !defined(DEFERRED_PASS)
353356
uint cov0 = (gsSlot >= 0) ? cableCoverage[gsSlot].x : 0u;
354357
// Per-segment ghost gating, mirroring the calc done lower in the FS
355358
// for live fragments. spawnAlongMain carries lenPerSeg for main
@@ -363,6 +366,7 @@ void main() {
363366
segBit0 = 0xFFFFFFu;
364367
}
365368
if ((cov0 & segBit0) == 0u) discard;
369+
#endif
366370

367371
// Flat ghost shade: light gray, slight capacity-driven brightening,
368372
// branches a touch dimmer. Alpha-blend over terrain (depth-write off
@@ -523,8 +527,10 @@ void main() {
523527
if (enemyOutOfLOS) {
524528
// Ghosts disabled: no SSBO read, no branch evaluation; just discard.
525529
if (ghostsEnabled < 0.5) discard;
530+
#if !defined(SHADOW_PASS) && !defined(DEFERRED_PASS)
526531
uint cov = (gsSlot >= 0) ? cableCoverage[gsSlot].x : 0u;
527532
if ((cov & segBit) == 0u) discard;
533+
#endif
528534
// Same flat translucent shading as the ghost-VBO fast path so
529535
// live-out-of-LOS and orphaned ghosts read identically.
530536
float capT2 = clamp(capacity / 100.0, 0.0, 1.0);
@@ -681,5 +687,3 @@ void main() {
681687
//alpha = 1.0;
682688
fragColor = vec4(color, alpha); // Mix in some of the underlying terrain
683689
}
684-
#if !defined(SHADOW_PASS) && !defined(DEFERRED_PASS)
685-
#endif

LuaRules/Gadgets/Shaders/gfx_overdrive_cables.geom.glsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@ uniform float ghostsEnabled; // 1.0 = run coverage SSBO updates, 0.0 = by
3535
//
3636
// Slots are declared as uvec4 because Spring's VBO API requires vec4-aligned
3737
// attributes; we only use `.x` and ignore `.yzw`.
38+
#if !defined(SHADOW_PASS) && !defined(DEFERRED_PASS)
3839
layout (std430, binding = 6) coherent buffer cableCoverageBuffer {
3940
uvec4 cableCoverage[];
4041
};
42+
#endif
4143

4244
in DataVS {
4345
vec2 vsWorldXZ;
@@ -799,5 +801,3 @@ void main() {
799801
gridD, timeD, cap, tCenter, spawnAlongMain, twigIdx, arcDh, numSeg);
800802
}
801803
}
802-
#if !defined(SHADOW_PASS) && !defined(DEFERRED_PASS)
803-
#endif

0 commit comments

Comments
 (0)