Guest User

Untitled

a guest
Apr 7th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // wave.vert - moves vertices along the normals
  2.  
  3. // time contains the seconds sind the progam was linked.
  4. uniform float time;
  5.  
  6.  
  7. //
  8. // entry point.
  9. //
  10. void main( void )
  11. {
  12.     float scale = 2.0;
  13.     float x = gl_Vertex.x;
  14.     float y = gl_Vertex.y;
  15.  
  16.     // calculate a scale factor.
  17.     float s = sin( (time+3.0*y)*scale );
  18.     float c = cos( (time+5.0*x)*scale );
  19.     float z = 0.05 * s * c;
  20.  
  21.     // offset the position along the normal.
  22.     vec3 v = gl_Vertex.xyz + gl_Normal * z;
  23.  
  24.     // transform the attributes.
  25.     gl_Position = gl_ModelViewProjectionMatrix * vec4( v, 1.0 );
  26.     gl_FrontColor = gl_Color;
  27.     gl_TexCoord[0] = gl_MultiTexCoord0;
  28. }
Add Comment
Please, Sign In to add comment