gallium: change remaining util functions to use cso sampler views
[mesa/mesa-lb.git] / progs / glsl / shadowtex.frag
bloba6a80da47f2db24ab51d28c0f6048285c841a0d8
1 // Fragment shader for 2D texture with shadow attenuation
2 // Brian Paul
5 uniform sampler2D tex2d;
6 uniform vec3 lightPos;
8 void main()
10    // XXX should compute this from lightPos
11    vec2 shadowCenter = vec2(-0.25, -0.25);
13    // d = distance from center
14    float d = distance(gl_TexCoord[0].xy, shadowCenter);
16    // attenuate and clamp
17    d = clamp(d * d * d, 0.0, 2.0);
19    // modulate texture by d for shadow effect
20    gl_FragColor = d * texture2D(tex2d, gl_TexCoord[0].xy, 0.0);