#version 450

layout(location = 0) in vec2 v_uv;
layout(location = 0) out vec4 out_color;
layout(set = 2, binding = 0) uniform sampler2D sprites;

layout(std140, set = 3, binding = 0) uniform UniformBlock {
  vec2 cam_pos;
  float time;
  float aspect;
  int post_mode;
  float zoom;
  float radius;
};

void main() {
  vec2 uv = 2.0 * v_uv - vec2(1.0);
  uv.y *= -1.0;
  uv.x *= aspect;
  float l = length(uv);
  if(l < radius) {
    uv /= zoom;
  }

  vec4 bg = texture(sprites, uv + cam_pos * 0.01);
  out_color = bg;


}

