uniform mat4 Eng_ObjectMatrix, Eng_ViewProjectionMatrix;
uniform float Eng_WaterMin;
uniform vec3 Eng_LocalLighting;
uniform float Offset;

varying vec4 ViewCoords;
varying float height;
varying vec2 TexCoord;
varying vec4 Clr;

void main()
{		 	
	TexCoord = gl_MultiTexCoord0.xy;
 	vec4 wvert = Eng_ObjectMatrix * gl_Vertex;
 	
	vec3 ll = Eng_LocalLighting;
	ll.z *= -1.0; 
	Clr = (max(0.0, dot(gl_Normal, ll)) * gl_LightSource[0].diffuse) + gl_LightSource[0].ambient;
	Clr.a = 1.0;

 	wvert.z -= Offset;
	height = Eng_WaterMin - wvert.z;

 	gl_Position = Eng_ViewProjectionMatrix * wvert;
    ViewCoords = gl_Position;
}
