ludwik_janiuk

shader_vert_earthquake

Apr 24th, 2014
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. //Shaders that will do anything to do nothing
  2. //Ludwik Janiuk
  3.  
  4. uniform float time;
  5. varying vec4 myGlobalColor;
  6.  
  7. float rand(vec2 co)
  8. {
  9. float a = 12.9898;
  10. float b = 78.233;
  11. float c = 43758.5453;
  12. float dt= dot(co.xy ,vec2(a,b));
  13. float sn= mod(dt,3.14);
  14. return fract(sin(sn) * c);
  15. }
  16.  
  17. void main() {
  18.  
  19. gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
  20. gl_Position = ftransform();
  21. myGlobalColor = gl_Color;
  22. float t = time/1000.0;
  23. float damping = 80.0;
  24. gl_Position.x += rand(gl_Position.yx + vec2(t, t))/damping;
  25. gl_Position.y += rand(gl_Position.xy + vec2(t, t))/damping;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment