#version 450 core uniform int ticks; uniform int scene; uniform float params[8]; uniform sampler2D images[8]; uniform vec2 resolution; layout (binding = 0,rgba32f) restrict uniform image2D backbuffer; int selection[12]; out vec4 fragColor; float random (in float x) { return fract(sin(x)*43758.5453123); } vec2 zoom(vec2 st, vec2 amount) { st -= 0.5; st /= amount; st += 0.5; return st; } vec2 translate(vec2 st, vec2 amount) { st -= 0.5; st += amount; st += 0.5; return st; } void main (void) { vec2 uv = gl_FragCoord.xy/resolution.xy; vec4 feedback = imageLoad(backbuffer,ivec2(gl_FragCoord.xy)); if (scene == 0) { vec4 logo = texture2D(images[0], zoom(uv,vec2(0.5+0.1*params[2],0.2+0.025*params[0]))); fragColor = mix(logo,feedback,0.7); } else if (scene == 1) { vec4 logo = texture2D(images[0], zoom(uv,vec2(0.5+0.1*params[2],0.2+0.025*params[0]))); vec4 img = texture2D(images[1],uv); float fade = ticks % (24*16)/(24*16.0); fragColor = mix(logo,img,fade); fragColor = mix(fragColor,feedback,0.7); } else if (scene == 2) { vec4 img = texture2D(images[1],zoom(uv,vec2(1.05-0.1*params[1]))); fragColor = mix(img,feedback,0.3); } else if (scene == 3) { vec4 img = texture2D(images[1],uv); img.rgb += 0.3 - vec3(params[0],params[1],params[2]); fragColor = mix(img,feedback,0.9); } else if (scene == 4) { float fade = ticks % (24*16)/(24*16.0); vec2 st = zoom(uv,vec2(1.05-0.1*params[1])); vec4 img = texture2D(images[1],st); img.rgb += 0.3 - vec3(params[0],params[1],params[2]); uv -= 0.5; uv *= 0.995-1.5*(vec2(random(float(ticks)),random(float(ticks)/417.94))-0.5)/vec2(120.,80.); uv += 0.5; vec4 newimg = texture2D(images[2],uv); fragColor = max(newimg*params[1],img);//; fragColor = mix(fragColor,feedback,0.5); } else if (scene == 5) { uv -= 0.5; if (feedback.r < feedback.b) { uv *= 0.995-2.5*(vec2(params[0]-0.5)/vec2(120.0,80.0)); } uv += 0.5; vec4 img = texture2D(images[2],uv); fragColor = mix(img,feedback,0.7); } else if (scene == 6) { uv -= 0.5; if (feedback.r > feedback.b) { if (params[1] > 0.3) uv *= 0.9-20.9*(vec2(random(float(ticks)),random(float(ticks)/417.94))-0.5)/vec2(120.,80.); } else if (params[2] > 0.5) { uv *= 0.995-1.7*(vec2(params[0]-0.5)/vec2(120.0,80.0)); } uv += 0.5; vec4 img = texture2D(images[2],uv); fragColor = mix(img,feedback,0.3); } else if (scene == 7) { uv -= 0.5; if (feedback.r > feedback.b) { uv += 0.5-vec2(params[0],params[1]); } else if (params[2] > 0.5) { uv *= 0.995-1.5*(vec2(random(float(ticks)),random(float(ticks)/417.94))-0.5)/vec2(120.,80.); } uv += 0.5; vec4 img = texture2D(images[2],uv); //if (feedback.r < feedback.b) { img *= 1.5*params[0]; } if (feedback.r < feedback.b) { img += 0.2-0.5*params[0]; } fragColor = mix(img,feedback,0.9); } else if (scene == 8) { vec4 newimg = texture2D(images[3],zoom(uv,vec2(1.05-0.05*params[0]))); uv -= 0.5; if (feedback.r > feedback.b) { uv += 0.5-vec2(params[0],params[1]); } else if (params[2] > 0.5) { uv *= 0.995-1.5*(vec2(random(float(ticks)),random(float(ticks)/417.94))-0.5)/vec2(120.,80.); } uv += 0.5; vec4 img = texture2D(images[2],uv); float fade = ticks % (24*16)/(24*16.0); img -= fade; fragColor = max(img,newimg*fade); fragColor = mix(fragColor,feedback,0.9); } else if (scene == 9) { vec4 img = texture2D(images[3],zoom(uv,vec2(1.05-0.05*params[0],1.05-0.1*params[2]))); fragColor = mix(img,feedback,0.2); } else if (scene == 10) { vec4 img = texture2D(images[3],zoom(uv,vec2(1.05-0.05*params[0],1.05-0.1*params[2]))); vec4 static_img = texture2D(images[3],uv); float fade = ticks % (24*16)/(24*16.0); static_img *= fade; if (static_img.b < static_img.g) { static_img += 2.0*params[1]; } fragColor = max(img,static_img); fragColor = mix(fragColor,feedback,0.3); } else if (scene == 11) { vec4 img = texture2D(images[3],uv); if (img.r+img.g+img.b > 2.0) { img.rgb += 2.5*vec3(params[0],params[1],params[2]); } vec4 newimg = texture2D(images[1],translate(zoom(uv,vec2(0.7)),vec2(0.4,-0.20))); if (params[1] > 0.1) { if (newimg.b > 0.5) { img = max(newimg,img); } } fragColor = mix(img,feedback,0.7); } else if (scene == 12) { vec4 logo = texture2D(images[4], zoom(uv,vec2(0.5,0.2))); vec4 img = texture2D(images[3],zoom(uv,vec2(1.05-0.05*params[0],1.05-0.1*params[2]))); float fade = ticks % (24*16)/(24*16.0); if (logo.r+logo.g+logo.b > 2.0) { logo *= fade; logo += params[1]; } fragColor = max(img,logo); fragColor = mix(fragColor,feedback,0.9); } else if (scene == 13) { vec4 logo = texture2D(images[4], zoom(uv,vec2(0.5,0.2))); vec4 img = texture2D(images[3],uv); fragColor = img+logo; } imageStore(backbuffer, ivec2(gl_FragCoord.xy), fragColor); }