
	varying vec3 normal;
	
	void main()
	{
		float intensity;
		vec4 color;
		vec3 n = normalize(normal);
		
		float colr=gl_FrontMaterial.diffuse.r;
		float colg=gl_FrontMaterial.diffuse.g;
		float colb=gl_FrontMaterial.diffuse.b;
		

		intensity = dot(vec3(gl_LightSource[0].position),n);

/*		if (intensity > 0.95)
			color = vec4(1.0,0.5,0.5,1.0);
		else if (intensity > 0.5)
			color = vec4(0.6,0.3,0.3,1.0);
		else if (intensity > 0.25)
			color = vec4(0.4,0.2,0.2,1.0);
		else
			color = vec4(0.2,0.1,0.1,1.0);
*/	
	
		if(intensity > 0.8)
			color = vec4(colr,colg,colb,1.0);
			else
		if(intensity > 0.75)
			color = vec4(colr*0.8,colg*0.8,colb*0.8,1.0);
		else
		if(intensity > 0.7)
		{
			if(mod(floor(gl_FragCoord.y),2.0)>0.5 )
				color = vec4(colr*0.3,colg*0.3,colb*0.3,1.0);
			else
				color = vec4(colr*0.7,colg*0.7,colb*0.7,1.0);
		}
		else
		if(intensity > 0.5)
		{
			 color = vec4(colr*0.1,colg*0.1,colb*0.1,1.0);
		}
		else
			color = vec4(colr*0.0,colg*0.0,colb*0.0,1.0);


		gl_FragColor = color;
	} 