#version 330 core

in VS_OUT {
  vec3 vert_normal;
  vec3 frag_position;
  vec2 uv_coords;
} fs_in;

uniform samplerCube cubemap;

layout (std140) uniform Common {
  mat4 projection;
  mat4 view;
  vec3 camera_position;
};

out vec4 color;

void main() {
  vec3 view_direction    = normalize(fs_in.frag_position - camera_position);
  vec3 reflect_direction = reflect(view_direction, normalize(fs_in.vert_normal));

  color = vec4(texture(cubemap, reflect_direction).rgb, 1.0);
}
