uniform mat4 mvp;
uniform highp float time;
uniform lowp vec2 dims;

in vec4 Position;
in vec2 TexCoord;
out lowp vec2 tc;
out lowp vec4 colorV;
out lowp float alpha;

float randomFloat(float i) {
	return fract(sin(i) * 43758.5453123);
}

void main() {
	colorV	 = vec4(1.f, 1.f, 1.f, 1.f);
	vec2 pos = Position.xy * dims;

	pos.y += time * 80.f * (1.f + randomFloat(pos.x));
	pos.y = mod(pos.y, dims.y);
	alpha = min(1.f, pos.y / dims.y / 0.2f);
	pos.x += sin(Position.y + pos.y / ((1.f + randomFloat(Position.x)) * 100.f)) * 40.f;
	pos.x = mod(pos.x, dims.x);
	pos += TexCoord * (1.f + 2.f * randomFloat(Position.y));

	tc			= TexCoord;
	gl_Position = mvp * vec4(pos, 0.f, 1.f);
}
