Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const vertexShader = `attribute vec2 g;
- attribute vec2 a;
- attribute vec2 t;
- attribute float r;
- attribute vec2 s;
- attribute vec4 c;
- attribute float z;
- attribute vec4 u;
- attribute vec4 y;
- uniform mat4 m;
- varying vec2 v;
- varying vec2 d;
- varying vec4 i;
- void main(){
- v=u.xy+g*u.zw;
- d=y.xy+g*y.zw;
- i=vec4(c.abg*c.r,c.r);
- vec2 p=(g-a)*s;
- float q=cos(r);
- float w=sin(r);
- p=vec2(p.x*q-p.y*w,p.x*w+p.y*q);
- p+=a+t;
- gl_Position=m*vec4(p,z,1);}`;
- const fragmentShader = `precision mediump float;
- uniform sampler2D x;
- uniform sampler2D k;
- uniform float j;
- uniform float time;
- varying vec2 v;
- varying vec2 d;
- varying vec4 i;
- void main(){
- vec4 c=texture2D(x,v);
- vec4 r=c*i;
- if(j>0.0){
- if(c.a<j)discard;
- r.rgb/=r.a;
- r.a=1.0;};
- //vec4 m=vec4(1.0,1.0,1.0,1.0);
- vec4 m=vec4(1.0);
- float frequency=20.0;
- float amplitude=0.005;
- float speed=0.02;
- float distortion= sin(d.y*frequency+time*speed)*amplitude;
- vec2 d2 = vec2(d.x+distortion, d.y);
- if(d.x+d.y!=0.0){m=texture2D(k,d2);};
- gl_FragColor=r*m;}`;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement