options_120.fs 537 B

12345678910111213141516171819202122
  1. // version 120 is needed for gl_PointCoord
  2. #version 120
  3. uniform vec4 uniform_color;
  4. uniform float percent_outline_radius;
  5. uniform float percent_center_radius;
  6. vec4 calc_color(float radius, vec4 color)
  7. {
  8. return ((radius < percent_center_radius) || (radius > 1.0 - percent_outline_radius)) ?
  9. vec4(0.5 * color.rgb, color.a) : color;
  10. }
  11. void main()
  12. {
  13. vec2 pos = (gl_PointCoord - 0.5) * 2.0;
  14. float radius = length(pos);
  15. if (radius > 1.0)
  16. discard;
  17. gl_FragColor = calc_color(radius, uniform_color);
  18. }