#version 330
uniform sampler2D tx;
uniform int colorize;
uniform vec4 color;
uniform vec2 pt;
uniform int beep;
in vec2 tc;
out vec4 oc;
void main(void) {
  if(beep==1) {
    float d=clamp((1.41422 - length(tc-pt))/1.4142,0.,1.);
    d=pow(d,2.0);
    if(d>0.99)
      oc=((d-0.99)/(1.-0.99))*color;
    else
      oc=texture(tx,tc);
  } else if(colorize==1)
    oc=color*vec4(texture(tx,tc).rgb,1.0);
  else
    oc=vec4(1.0, 0.0, 0.0, 1.0) + vec4(texture(tx,tc).rgb, 1.0);
}
