#version 450
// vim: ft=c
// clang-format off

layout(binding = 1) uniform samplerCube combined_image;

layout(location = 0) out vec4 outColor;

layout(location = 0) in vec4 normal;
layout(location = 1) in vec4 pos_pre;
layout(location = 2) in vec4 view_orig;

layout(push_constant, std430) uniform pc {
  layout(offset=48) vec4 data;
};

void main() {
  vec4 ray = pos_pre - view_orig;
  outColor = texture(combined_image, vec3(reflect(ray, normal)));
  // outColor = vec4(data.rgb*(1.0+dot(normal.xyz, normalize(vec3(-0.7, -0.5, -0.1))))/2.0, 1.0);
//if(pos_post.z <= 0.0) {
//  outColor = vec4(1.0);
//}
  //outColor = normal.xyz;
  //outColor = vec4(vec3(1.0-gl_FragCoord.z), 1.0);
}
