varying float height, air;
varying vec2 TexCoord0, TexCoord1;

uniform sampler2D DiffuseMap;
uniform sampler2D LightMap;
uniform vec4 Eng_WaterDeepColor;
uniform float Eng_WaterDeepVisibility;

void main()
{
	if (air > 0.0)
  		discard;
	else
	{
		vec4 light = texture2D(LightMap, TexCoord1) * gl_LightSource[0].diffuse;	
		vec4 clr = texture2D(DiffuseMap, TexCoord0) * (light + gl_LightSource[0].ambient);						
		gl_FragColor = mix(clr, Eng_WaterDeepColor, min(Eng_WaterDeepVisibility, height) / Eng_WaterDeepVisibility);
	}				
}
