istereo

diff sdr/test.p.glsl @ 22:889dade25667

added fog
author John Tsiombikas <nuclear@mutantstargoat.com>
date Wed, 07 Sep 2011 10:56:18 +0300
parents b39d8607f4bb
children
line diff
     1.1 --- a/sdr/test.p.glsl	Wed Sep 07 10:49:11 2011 +0300
     1.2 +++ b/sdr/test.p.glsl	Wed Sep 07 10:56:18 2011 +0300
     1.3 @@ -4,13 +4,19 @@
     1.4  
     1.5  uniform sampler2D tex;
     1.6  
     1.7 +varying vec3 vpos;
     1.8  varying vec4 var_color;
     1.9  varying vec2 var_texcoord;
    1.10  
    1.11  void main()
    1.12  {
    1.13 +	vec4 fog_color = vec4(0.6, 0.6, 0.6, 1.0);
    1.14 +
    1.15 +	float fog = exp(-(0.2 * -vpos.z));
    1.16 +
    1.17  	vec4 texel = texture2D(tex, var_texcoord);
    1.18  	texel.w = 1.0;
    1.19  
    1.20 -	gl_FragColor = var_color * texel;
    1.21 +	vec4 col = var_color * texel;
    1.22 +	gl_FragColor = mix(fog_color, col, fog);
    1.23  }