#version 400

in vec4 fragNormal;
in vec4 eyePos;
in vec4 eyeMirrorPlane;

out vec4 result;

// This is the actual code that is executed.
void main( void )
{
	// We want to discard things below the mirror!
	if (dot(eyePos,eyeMirrorPlane) <= 0) discard;

	// If the normal got scaled due to our modelview, renormalize it
	vec3 norm = normalize(fragNormal.xyz);
	
	// Color the cow surface based on how much the normal faces the viewer.
	result = vec4( vec3( abs(norm.z) ), 1.0f );
}