pointSpritePS.glsl 681 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #version 330
  2. precision highp float;
  3. in Fragment
  4. {
  5. vec4 color;
  6. } fragment;
  7. in vec3 ambient;
  8. out vec4 color;
  9. void main_textured(void)
  10. {
  11. color = fragment.color;//texture2D(Diffuse,vert.texcoord);//fragment.color;
  12. }
  13. void main(void)
  14. {
  15. vec3 N;
  16. N.xy = gl_PointCoord.st*vec2(2.0, -2.0) + vec2(-1.0, 1.0);
  17. float mag = dot(N.xy, N.xy);
  18. if (mag > 1.0) discard;
  19. vec4 texel = fragment.color;//vec4(1,0,0,1);//fragment.color*texture(Diffuse,vert.texcoord);//fragment.color;
  20. vec3 ct;
  21. float at,af;
  22. af = 1.0;
  23. ct = texel.rgb;
  24. at = texel.a;
  25. vec3 lightDir= vec3(1,0,0);
  26. float diffuse = max(0.0, dot(lightDir, N));
  27. color = vec4(ct * diffuse, at * af);
  28. }