varying float height, z;
varying vec2 TexCoord;

uniform float RangeCorrection;
uniform float WavesInvSize;
uniform float SurgeHeight;

void main()
{
	vec4 vert = gl_Vertex;
	z = vert.z;
	height = clamp((vert.z + SurgeHeight) / SurgeHeight, 0.0, 1.0);
	vert.z = 0.0;
	
	TexCoord = vert.xy * WavesInvSize;

	gl_Position = gl_ModelViewProjectionMatrix * vert;
	gl_Position.w *= RangeCorrection;
}