mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 15:21:51 +00:00
37 lines
671 B
Text
37 lines
671 B
Text
|
uniform int fogenabled;
|
||
|
uniform vec4 fogcolor;
|
||
|
uniform vec3 camerapos;
|
||
|
varying vec4 pixelpos;
|
||
|
varying vec4 fogparm;
|
||
|
|
||
|
//===========================================================================
|
||
|
//
|
||
|
// Main shader routine
|
||
|
//
|
||
|
//===========================================================================
|
||
|
|
||
|
void main()
|
||
|
{
|
||
|
float fogdist;
|
||
|
float fogfactor;
|
||
|
|
||
|
//
|
||
|
// calculate fog factor
|
||
|
//
|
||
|
#ifndef NO_SM4
|
||
|
if (fogenabled == -1)
|
||
|
{
|
||
|
fogdist = pixelpos.w;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
fogdist = max(16.0, distance(pixelpos.xyz, camerapos));
|
||
|
}
|
||
|
#else
|
||
|
fogdist = pixelpos.w;
|
||
|
#endif
|
||
|
fogfactor = exp2 (fogparm.z * fogdist);
|
||
|
gl_FragColor = vec4(fogcolor.rgb, 1.0 - fogfactor);
|
||
|
}
|
||
|
|