2012-01-04 09:47:03 +00:00
|
|
|
//precision mediump float;
|
2012-01-19 01:38:05 +00:00
|
|
|
uniform sampler2D palette;
|
2012-01-29 01:27:28 +00:00
|
|
|
uniform vec4 fog;
|
2012-01-19 01:38:05 +00:00
|
|
|
|
2012-01-04 09:47:03 +00:00
|
|
|
varying float color;
|
|
|
|
|
2012-01-29 01:27:28 +00:00
|
|
|
float
|
|
|
|
sqr (float x)
|
|
|
|
{
|
|
|
|
return x * x;
|
|
|
|
}
|
|
|
|
|
|
|
|
vec4
|
|
|
|
fogBlend (vec4 color)
|
|
|
|
{
|
|
|
|
float f;
|
|
|
|
vec4 fog_color = vec4 (fog.rgb, 1.0);
|
|
|
|
|
|
|
|
f = exp (-sqr (fog.a / gl_FragCoord.w));
|
|
|
|
return mix (fog_color, color, f);
|
|
|
|
}
|
|
|
|
|
2012-01-04 09:47:03 +00:00
|
|
|
void
|
|
|
|
main (void)
|
|
|
|
{
|
|
|
|
if (color == 1.0)
|
|
|
|
discard;
|
2012-01-29 01:27:28 +00:00
|
|
|
gl_FragColor = fogBlend (texture2D (palette, vec2 (color, 0.0)));
|
2012-01-04 09:47:03 +00:00
|
|
|
}
|