	uniform float colr;
	uniform float colg;
	uniform float colb;
	varying vec3 normal;
	uniform samplerRECT map_diffuse;
		
	void main()
	{
		float intensity;
		vec4 color;
		vec3 n = normalize(normal);

		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.0)
		{
			color=vec4(0,0,0,1);
		}
		else	 
		if(intensity > 0.95)
			color = vec4(colr,colg,colb,1.0);
		else
		{
			float it=intensity;
			
			if(it>0.0 && it<0.1)it=0.0;
			if(it>0.1 && it<0.2)it=0.1;
			if(it>0.2 && it<0.3)it=0.15;
			if(it>0.3 && it<0.4)it=0.4;
			if(it>0.4 && it<0.5)it=0.5;
			if(it>0.5 && it<0.6)it=0.6;
			if(it>0.6 && it<0.7)it=0.69;
			if(it>0.7 && it<0.8)it=0.79;
			if(it>0.8 && it<0.9)it=0.89;
			if(it>0.9 && it<1.0)it=0.99;

			if(mod(floor(gl_FragCoord.y),2.0)>0.5 )
			color = vec4(colr*it,colg*it,colb*it,1.0);			
			else
			color = vec4(colr*it*0.95,colg*it*0.95,colb*it*0.95,1.0);
			
		}

color*=0.6;
color+=(intensity*color)*0.4;

		color+= texRECT(map_diffuse, vec2(gl_FragCoord.x,gl_FragCoord.y))*0.2;
		color.a=1.0;


		gl_FragColor = color;
	} 
	
	
	
	
	
	