From 71570bb2eff28a720b3381b88cfc782c483ded28 Mon Sep 17 00:00:00 2001 From: apartfromtime <42292382+apartfromtime@users.noreply.github.com> Date: Sat, 9 Dec 2023 12:28:30 +1100 Subject: [PATCH] Revert changes to shaders Uses min/max from shader language. --- src/client/refresh/gl3/gl3_shaders.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/client/refresh/gl3/gl3_shaders.c b/src/client/refresh/gl3/gl3_shaders.c index 31b8a400..d5741f23 100644 --- a/src/client/refresh/gl3/gl3_shaders.c +++ b/src/client/refresh/gl3/gl3_shaders.c @@ -576,7 +576,7 @@ static const char* fragmentSrc3Dlm = MULTILINE_STRING( vec3 lightToPos = dynLights[i].lightOrigin - passWorldCoord; float distLightToPos = length(lightToPos); - float fact = Q_max(0.0, intens - distLightToPos - 52.0); + float fact = max(0.0, intens - distLightToPos - 52.0); // move the light source a bit further above the surface // => helps if the lightsource is so close to the surface (e.g. grenades, rockets) @@ -585,7 +585,7 @@ static const char* fragmentSrc3Dlm = MULTILINE_STRING( lightToPos += passNormal*32.0; // also factor in angle between light and point on surface - fact *= Q_max(0.0, dot(passNormal, normalize(lightToPos))); + fact *= max(0.0, dot(passNormal, normalize(lightToPos))); lmTex.rgb += dynLights[i].lightColor.rgb * fact * (1.0/256.0); @@ -663,7 +663,7 @@ static const char* fragmentSrc3DlmNoColor = MULTILINE_STRING( vec3 lightToPos = dynLights[i].lightOrigin - passWorldCoord; float distLightToPos = length(lightToPos); - float fact = Q_max(0.0, intens - distLightToPos - 52.0); + float fact = max(0.0, intens - distLightToPos - 52.0); // move the light source a bit further above the surface // => helps if the lightsource is so close to the surface (e.g. grenades, rockets) @@ -672,7 +672,7 @@ static const char* fragmentSrc3DlmNoColor = MULTILINE_STRING( lightToPos += passNormal*32.0; // also factor in angle between light and point on surface - fact *= Q_max(0.0, dot(passNormal, normalize(lightToPos))); + fact *= max(0.0, dot(passNormal, normalize(lightToPos))); lmTex.rgb += dynLights[i].lightColor.rgb * fact * (1.0/256.0); @@ -801,7 +801,7 @@ static const char* fragmentSrcAlias = MULTILINE_STRING( // apply gamma correction and intensity texel.rgb *= intensity; texel.a *= alpha; // is alpha even used here? - texel *= Q_min(vec4(1.5), passColor); + texel *= min(vec4(1.5), passColor); outColor.rgb = pow(texel.rgb, vec3(gamma)); outColor.a = texel.a; // I think alpha shouldn't be modified by gamma and intensity @@ -864,7 +864,7 @@ static const char* fragmentSrcParticles = MULTILINE_STRING( outColor.rgb = pow(texel.rgb, vec3(gamma)); // I want the particles to fade out towards the edge, the following seems to look nice - texel.a *= Q_min(1.0, particleFadeFactor*(1.0 - distSquared)); + texel.a *= min(1.0, particleFadeFactor*(1.0 - distSquared)); outColor.a = texel.a; // I think alpha shouldn't be modified by gamma and intensity }