/*************************************************************
GLSL Demo - Phong fragment shader
(c) 2005 Antoine Bouthors, EVASION
*************************************************************/

varying vec3 normal;
varying vec3 lightDir;

void main()
{
	vec3 Nnormal = normalize( normal );
	vec3 NlightDir = normalize( lightDir );
	vec3 ReflectedRay = reflect( NlightDir, Nnormal );
	
	vec3 color = vec3( clamp( pow( dot( ReflectedRay, vec3( 0., 0., -1. ) ), 10. ), 0., 1. ) );
	color += gl_LightSource[0].diffuse.xyz * clamp( dot( Nnormal, NlightDir ), 0., 1. );
	gl_FragColor.xyz = .1 + .9*color;
}
