Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Aurora Effect Vert Shader
- by Eddie Lee (twitter: @eddietree)
- http://illogictree.com
- Jan 30, 2012
- */
- #version 110
- varying vec2 uv;
- uniform vec4 v0;
- uniform vec4 v1;
- uniform vec4 tan0;
- uniform vec4 tan1;
- vec3 hermite( vec3 p0, vec3 t0, vec3 p1, vec3 t1, float alpha )
- {
- float t = alpha;
- float t_sqr = alpha*alpha;
- float t_cubed = alpha*alpha*alpha;
- float h1 = 2.0*t_cubed - 3.0*t_sqr + 1.0; // calculate basis function 1
- float h2 = -2.0*t_cubed + 3.0*t_sqr; // calculate basis function 2
- float h3 = t_cubed - 2.0*t_sqr + t; // calculate basis function 3
- float h4 = t_cubed - t_sqr; // calculate basis function 4
- return h1*p0 + h2*p1 + h3*t0 + h4*t1;
- }
- void main()
- {
- // interpolate on x (assume verts are normalized in x,y )
- float splineAlpha = gl_Vertex.x;
- vec3 pos = hermite( v0.xyz, tan0.xyz, v1.xyz, tan1.xyz, splineAlpha);
- pos.y += gl_Vertex.y * 600.0;
- gl_Position = gl_ModelViewProjectionMatrix * vec4(pos.xy,0.0,1.0);
- uv = gl_Vertex.xy;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement