Clone of mesa.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

shadowtex.frag 487B

123456789101112131415161718192021
  1. // Fragment shader for 2D texture with shadow attenuation
  2. // Brian Paul
  3. uniform sampler2D tex2d;
  4. uniform vec3 lightPos;
  5. void main()
  6. {
  7. // XXX should compute this from lightPos
  8. vec2 shadowCenter = vec2(-0.25, -0.25);
  9. // d = distance from center
  10. float d = distance(gl_TexCoord[0].xy, shadowCenter);
  11. // attenuate and clamp
  12. d = clamp(d * d * d, 0.0, 2.0);
  13. // modulate texture by d for shadow effect
  14. gl_FragColor = d * texture2D(tex2d, gl_TexCoord[0].xy, 0.0);
  15. }