Advertisement
Guest User

Untitled

a guest
Apr 6th, 2019
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const vertexShader = `attribute vec2 g;
  2. attribute vec2 a;
  3. attribute vec2 t;
  4. attribute float r;
  5. attribute vec2 s;
  6. attribute vec4 c;
  7. attribute float z;
  8. attribute vec4 u;
  9. attribute vec4 y;
  10. uniform mat4 m;
  11. varying vec2 v;
  12. varying vec2 d;
  13. varying vec4 i;
  14. void main(){
  15. v=u.xy+g*u.zw;
  16. d=y.xy+g*y.zw;
  17. i=vec4(c.abg*c.r,c.r);
  18. vec2 p=(g-a)*s;
  19. float q=cos(r);
  20. float w=sin(r);
  21. p=vec2(p.x*q-p.y*w,p.x*w+p.y*q);
  22. p+=a+t;
  23. gl_Position=m*vec4(p,z,1);}`;
  24.  
  25. const fragmentShader = `precision mediump float;
  26. uniform sampler2D x;
  27. uniform sampler2D k;
  28. uniform float j;
  29. uniform float time;
  30. varying vec2 v;
  31. varying vec2 d;
  32. varying vec4 i;
  33. void main(){
  34. vec4 c=texture2D(x,v);
  35. vec4 r=c*i;
  36. if(j>0.0){
  37. if(c.a<j)discard;
  38. r.rgb/=r.a;
  39. r.a=1.0;};
  40. //vec4 m=vec4(1.0,1.0,1.0,1.0);
  41. vec4 m=vec4(1.0);
  42.  
  43. float frequency=20.0;
  44. float amplitude=0.005;
  45. float speed=0.02;
  46. float distortion= sin(d.y*frequency+time*speed)*amplitude;
  47.  
  48. vec2 d2 = vec2(d.x+distortion, d.y);
  49.  
  50.  
  51. if(d.x+d.y!=0.0){m=texture2D(k,d2);};
  52.  
  53. gl_FragColor=r*m;}`;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement