2013-11-30 16:33:06 -05:00
|
|
|
uniform float screenw;
|
|
|
|
uniform float time;
|
|
|
|
uniform mat4 viewm;
|
|
|
|
uniform vec3 campos;
|
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
const float size = 0.5;
|
|
|
|
|
|
|
|
// This simulation will run accurately for a bit under five days.
|
|
|
|
vec4 start = gl_Vertex;
|
|
|
|
start.y -= time;
|
|
|
|
|
|
|
|
// How many times has it fell?
|
|
|
|
float count = floor(start.y / 24.0);
|
|
|
|
start.x += sin(count);
|
|
|
|
start.z += cos(count);
|
|
|
|
|
|
|
|
vec2 signs = sign(start.xz);
|
|
|
|
start.xz = mod(start.xz, 17.5) * signs;
|
|
|
|
|
|
|
|
start.y = mod(start.y, 24.0) - 3.0;
|
|
|
|
|
|
|
|
start.xyz += campos;
|
|
|
|
|
|
|
|
vec4 eyepos = viewm * start;
|
|
|
|
vec4 projCorner = gl_ProjectionMatrix * vec4(vec2(size), eyepos.z, eyepos.w);
|
|
|
|
|
|
|
|
gl_PointSize = screenw * projCorner.x / projCorner.w;
|
|
|
|
gl_Position = gl_ProjectionMatrix * eyepos;
|
|
|
|
|
2013-12-19 18:58:26 -05:00
|
|
|
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
2013-11-30 16:33:06 -05:00
|
|
|
}
|