stk-code_catmod/data/shaders/rain.vert
samuncle 73f9779324 Animated texture corrected. Thanks to vlj :)
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14738 178a84e3-b1eb-0310-8ba1-8eac791a3b58
2013-12-19 23:58:26 +00:00

34 lines
760 B
GLSL

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;
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
}