#version 460
layout(location = 0) in vec3 a_pos;
layout(location = 1) in vec2 a_uv;
layout(location = 2) in vec3 a_normal;

layout(location = 0) out vec4 v_color;
layout(location = 1) out vec2 v_uv;
layout(location = 2) out vec3 v_normal_vs;  // view-space normal

layout(std140, set = 1, binding = 0) uniform UniformBlock {
  mat4 model;
  mat4 view;
  mat4 proj;
  mat4 inv_view;
  mat4 inv_proj;
  vec4 cam_pos;
  float time;
  int post_mode;
  vec2 atlas_adjust;
};

void main() {
  vec4 view_pos = view * model * vec4(a_pos, 1.0);
  gl_Position = proj * view_pos;
  v_color = vec4(a_uv, abs(sin(a_uv.x*a_uv.y)), 1.0);
  v_uv = a_uv*atlas_adjust;

  v_normal_vs = normalize(a_normal);
}
