1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Remove redundant stuff and other small fixes

This commit is contained in:
Gefüllte Taubenbrust 2024-12-02 18:00:59 +01:00
parent 1fa9731172
commit 45289b6919
6 changed files with 21 additions and 50 deletions

View file

@ -450,7 +450,17 @@ void main(void)
float clarity = clamp(fogShadingParameter
- fogShadingParameter * length(eyeVec) / fogDistance, 0.0, 1.0);
#ifdef ENABLE_TINTED_FOG
float fogColorMax = max(max(fogColor.r, fogColor.g), fogColor.b);
// Prevent zero division.
if (fogColorMax < 0.0000001) fogColorMax = 1.0;
// For high clarity (light fog) we tint the fog color.
// For this to not make the fog color artificially dark we need to normalize using the
// fog color's brightest value. We then blend our base color with this to make the fog.
col = mix(fogColor * pow(fogColor / fogColorMax, vec4(2.0 * clarity)), col, clarity);
#else
col = mix(fogColor, col, clarity);
#endif
col = vec4(col.rgb, base.a);