From 56bac8faa7feedc51f64cb1b64e1a71fe237270d Mon Sep 17 00:00:00 2001 From: Xonk Date: Sun, 19 Apr 2026 00:11:04 -0400 Subject: [PATCH] fix oopsie compile error --- shaders/dimensions/final.fsh | 58 +++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/shaders/dimensions/final.fsh b/shaders/dimensions/final.fsh index f9267c2..1096c61 100644 --- a/shaders/dimensions/final.fsh +++ b/shaders/dimensions/final.fsh @@ -166,37 +166,39 @@ void doCameraGridLines(inout vec3 color, in vec2 texcoord){ color = mix(color, vec3(1.0), gridLines); } -void doColorKeying(inout vec3 color){ - // get distance from the camera in meters - #ifdef USING_LOD_MOD - float linearDistance = length(mat3(gbufferModelViewInverse)*toScreenSpace_DH(gl_FragCoord.xy*texelSize, texelFetch(depthtex0,ivec2(gl_FragCoord.xy),0).r, texelFetch(LOD_DEPTHTEX0,ivec2(gl_FragCoord.xy),0).r)); - #else - float linearDistance = length(mat3(gbufferModelViewInverse)*toScreenSpace(vec3(gl_FragCoord.xy*texelSize, texelFetch(depthtex0,ivec2(gl_FragCoord.xy),0).r))); - #endif +#ifdef COLOR_KEYING + void doColorKeying(inout vec3 color){ + // get distance from the camera in meters + #ifdef USING_LOD_MOD + float linearDistance = length(mat3(gbufferModelViewInverse)*toScreenSpace_DH(gl_FragCoord.xy*texelSize, texelFetch(depthtex0,ivec2(gl_FragCoord.xy),0).r, texelFetch(LOD_DEPTHTEX0,ivec2(gl_FragCoord.xy),0).r)); + #else + float linearDistance = length(mat3(gbufferModelViewInverse)*toScreenSpace(vec3(gl_FragCoord.xy*texelSize, texelFetch(depthtex0,ivec2(gl_FragCoord.xy),0).r))); + #endif - // set range(s) - linearDistance = linearDistance - COLOR_KEY_RANGE; - - // configure width n shiz - #if COLOR_KEY_WIDTH > 0 - linearDistance /= COLOR_KEY_WIDTH*0.5; - #ifdef COLOR_KEY_INVERT - linearDistance = -1.0 + abs(linearDistance); + // set range(s) + linearDistance = linearDistance - COLOR_KEY_RANGE; + + // configure width n shiz + #if COLOR_KEY_WIDTH > 0 + linearDistance /= COLOR_KEY_WIDTH*0.5; + #ifdef COLOR_KEY_INVERT + linearDistance = -1.0 + abs(linearDistance); + #else + linearDistance = 1.0 - abs(linearDistance); + #endif + linearDistance *= COLOR_KEY_WIDTH*0.5; #else - linearDistance = 1.0 - abs(linearDistance); + #ifdef COLOR_KEY_INVERT + linearDistance = 1.0 - linearDistance; + #else + linearDistance = -1.0 + linearDistance; + #endif #endif - linearDistance *= COLOR_KEY_WIDTH*0.5; - #else - #ifdef COLOR_KEY_INVERT - linearDistance = 1.0 - linearDistance; - #else - linearDistance = -1.0 + linearDistance; - #endif - #endif - - // composite - if(linearDistance > 0.0) color = vec3(COLOR_KEY_R,COLOR_KEY_G,COLOR_KEY_B); -} + + // composite + if(linearDistance > 0.0) color = vec3(COLOR_KEY_R,COLOR_KEY_G,COLOR_KEY_B); + } +#endif void main() {