layout (location = 0) in vec3 a_position;
layout (location = 1) in vec3 a_normal;
layout (location = 2) in vec3 a_tangent;
layout (location = 3) in vec2 a_uv;

layout (location = 0) out vec2 v_depth_map_uv;
//layout (location = 1) out vec2 v_uv;
layout (location = 1) out vec3 v_ray_eye;
layout (location = 2) out vec3 v_ray_direction;

layout (set = 0, binding = 0) uniform Uniforms {
    mat4 g_projection_from_camera;
    mat4 g_camera_from_world;
};

void main() {
    gl_Position = vec4(a_position.x, -a_position.y, 0, 1);
    v_depth_map_uv = a_uv;

    vec2 screen_uv = a_uv * 2 - 1;
    calculate_ray(g_projection_from_camera, g_camera_from_world, screen_uv, v_ray_eye, v_ray_direction);

//    mat4 world_from_camera = inverse(g_camera_from_world);
//    v_ray_eye = (world_from_camera * vec4(v_ray_eye, 1)).xyz;
//    v_ray_direction = (world_from_camera * vec4(v_ray_direction, 0)).xyz;
}