precision lowp float;

uniform sampler2D Texture;
uniform sampler2D NormalMap;
uniform vec3 LightDirection;
uniform float TimeOfDayCoef1;
uniform float TimeOfDayCoef2;
uniform float invCoef;
uniform vec3 TimeOfDayColor;
varying vec2 texCoord;

varying vec3 camVec;
varying vec3 normVec;
varying vec3 posVec;

void main() 
{

	vec3 nvec = normalize(normVec);
	
	float cosf = max(0.0, dot(nvec, LightDirection));
	
	//gl_FragColor =  vec4((texture2D(Texture, texCoord).rgb * (cosf * 0.75 + 0.25)), 1.0); //day
	//gl_FragColor =  vec4((texture2D(Texture, texCoord).rgb * (cosf * 0.5 + 0.25)), 1.0); //twilight
	//gl_FragColor =  vec4(((texture2D(Texture, texCoord).rgb + vec3(0.0, 0.1, 0.2)) * (0.4)), 1.0);
	
	gl_FragColor =  vec4(((texture2D(Texture, texCoord).rgb + TimeOfDayColor) * (cosf * TimeOfDayCoef1 + TimeOfDayCoef2)), 1.0);
	
	if (posVec.y < 0.0)
	{
		discard;
		//gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
	}
}