varying vec3 normal;
varying vec4 color;

void main()
{
	// normalize the normal after interpolation

	vec3 lightdir = normalize(vec3(1,1,1));
	//vec3 lightdir = -normalize(vec3(10,10,10));
	if(false)
	{
		float c = dot(lightdir, normalize(normal));
		if(c < 0.0) c = 0.0;
		c = pow(c, 0.3);
		c = 0.25 + c*0.75;
		gl_FragColor = vec4(color.r*c,color.g*c,color.b*c, 1.0);
	}
	else
	{
		//vec3 lightdir = vec3(0.0,0.0,1.0);
		float c = (1.0+dot(lightdir, normal))/2.0;
		gl_FragColor = vec4(color.r*c,color.g*c,color.b*c, 1.0);
	}

	//gl_FragColor = vec4(normal.xyz, 1.0);
}