in vec2 uv;

out vec4 fragColor;

uniform sampler2D image;

uniform float fTime;
uniform float nTime;

uniform int pass;
uniform vec2 resolution;

uniform float multiplicate; // 1
uniform float verticalrun; // 0
uniform float flipx; // -1
uniform float flipy; // -1
uniform float glitch1; // 0
uniform float glitch2; // 0
uniform float flash; // 0

void main() {
    fragColor = vec4(1, 0, 1, 1);
    if(pass == 0)
    {
        vec2 uv2=uv;
        uv2-=0.5;
        vec2 cuv=uv2;
        uv2*=(1.0+pow(length(uv2),2.0)*0.2  )*0.91;
        uv2+=0.5;
        float n=fract(fract(uv2.x*uv2.x*404.0+uv2.y*uv2.y*123.0+uv2.x*uv2.y*1234.24+dot(gl_FragCoord.xy,vec2(1.1,92.4)))*94.24);
        n=fract(n*n*312.123+n*312.94+1.741);
        n=fract(n*n*312.123+n*312.94+1.741);

        // multiplicate
        uv2*=multiplicate;

        // fun part
        uv2.y+=fTime*verticalrun*2.0;

        // flippers
        uv2.y*=-flipx;
        uv2.x*=-flipy;

        fragColor = texture(image,uv2);
        // glitch 1
        fragColor = texture(image,uv2*1.0
            +fragColor.xy*glitch1
            -mod(uv2-fTime*4.0,0.01+sin(fTime*1.0)*0.01)*glitch2);

        fragColor*=1.0+flash*2.0;
        fragColor+=n*0.05-0.025;
        fragColor*=1.0-length(cuv)*0.5;
        fragColor*=1.5;
        fragColor*=sin(uv2.y*1500.0+fTime)*0.2+1.0;
        fragColor*=sin(uv2.y*400.0+fTime)*0.1+1.0;
    }
    else if(pass == 1)  
    {
        fragColor = texture(image,uv*1.0);
    }
}
