
uniform sampler2D colorMap;

uniform float angle;
uniform float amount; 
uniform float width; 

vec2 rotateVector (vec2 vec, float ang)
{
    vec2 res = vec2(
        vec.x * cos(ang) - vec.y * sin(ang),
        vec.x * sin(ang) + vec.y * cos(ang)
    );
    return res;
}


void main ()
{
    
    
    vec2 uv = gl_FragCoord.xy/1080.0;

    vec2 uv2=uv;
    uv2.x/=(1920.0/1080.0);
    
    uv-=vec2(0.5,0.5);
    
    
    uv=rotateVector(uv,angle);
    uv-=vec2(0.5,0.5);
    
    vec2 move=vec2(1.0/1920.0,0.0);
    
    move=rotateVector(move,-(angle+3.14/2.0));
    move.x/=(1920.0/1080.0);

    
    float c = uv.x; c = mod(c, width*2.0); c = step(c, width);

    if (c<1.0) move=-move;
    uv2+=move*amount;
    vec4 c2=texture2D(colorMap,uv2);

    if (uv2.x<0.0) c2=vec4(0.0);
    if (uv2.x>1.0) c2=vec4(0.0);
    if (uv2.y<0.0) c2=vec4(0.0);
    if (uv2.y>1.0) c2=vec4(0.0);

    
    
	gl_FragColor=c2;
}