mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-02-02 06:33:20 +00:00
28 lines
622 B
GLSL
28 lines
622 B
GLSL
|
|
vec4 Lightmode_Default()
|
|
{
|
|
vec4 color = vColor;
|
|
|
|
#if defined(FOG_BEFORE_LIGHTS)
|
|
|
|
// calculate fog factor
|
|
#if defined(FOG_RADIAL)
|
|
float fogdist = max(16.0, distance(pixelpos.xyz, uCameraPos.xyz));
|
|
#else
|
|
float fogdist = max(16.0, pixelpos.w);
|
|
#endif
|
|
float fogfactor = exp2 (uFogDensity * fogdist);
|
|
|
|
// brightening around the player for light mode 2
|
|
if (fogdist < uLightDist)
|
|
{
|
|
color.rgb *= uLightFactor - (fogdist / uLightDist) * (uLightFactor - 1.0);
|
|
}
|
|
|
|
// apply light diminishing through fog equation
|
|
color.rgb = mix(vec3(0.0, 0.0, 0.0), color.rgb, fogfactor);
|
|
|
|
#endif
|
|
|
|
return color;
|
|
}
|