// All content © 2010-2011 DigiPen (USA) Corporation, all rights reserved.

//shader to render a directional light's properties into the light buffer.

#version 150

// ---------------------------------------------------------------------------
//uniforms

//light variables
uniform float		uSpecular; //specular component 
uniform vec4		uDiffuse; //diffuse component
uniform float		uIntensity; //light intensity
uniform vec3		uLightDir; //reverse direction of this light in view space

uniform sampler2D	uGBuffer; //geometry buffer storing depth + normals

// ---------------------------------------------------------------------------
// varyings

in vec3				vEyeScreenRay;

// ---------------------------------------------------------------------------

out vec4			out_Color;

void main()
{
	vec4 nrmDepth = texelFetch( uGBuffer, ivec2( gl_FragCoord.xy ), 0 );
	out_Color = vec4( (uDiffuse * max( dot(nrmDepth.rgb, uLightDir), 0.0 ) ).rgb, //diffuse * nl
					/*pow( dot( normalize( reflect(lightVec, nrmDepth.rgb) ), normalize( vEyeScreenRay ) ), uSpecular ) )*/ 0.0 ) //specular
				* uIntensity;
}
