#version 330 core
//based on RTR tutorial 2010
//Omindirectional Shadowmapping, presentation by Peter Houska

uniform vec2 near_far; //near and far plane for cm cams
uniform vec4 light_pos; //world space light position

in vec4 WS_pos_from_GS;

out vec4 out_color;

void main(void) {

	//calculate distance
	float WS_dist = distance(WS_pos_from_GS, light_pos);

	//map value to [0;1] by dividing far plane distance
	float WS_dist_normalized = WS_dist / near_far.y;

	//out_color = vec4(1.0f, WS_dist_normalized, WS_dist_normalized, 1.0f);

	gl_FragDepth = WS_dist_normalized;

}