
#version 150

out vec3 c;
in vec4 pos;
in vec4 gpos;

uniform float distort;

void main(void)
{
	vec2 pc = (gl_PointCoord.xy-vec2(0.5,0.5))*2.f;
	vec3 py = max(vec3(0.f), 105.f-abs(pos.yyy));
	vec3 m = pos.yyy*2;
	c = 1.f-min(vec3(1.0f),
			pow(sqrt(vec3(dot(pc,pc))),
				vec3(1.f))
			);
	c *= max(vec3(0.f),vec3(max(0.2,0.8-distort*0.04),max(0.8-distort*0.05,0.1),max(0.0,0.5-distort*0.06))*m);
	c *= clamp(16000-gpos.z,0,16000)*0.001/16.f;
}
