#version 460 #include inc_functions.glsl #include inc_magic.glsl in vec2 vUV; out vec4 fragColor; uniform sampler2D iTex0; // feedback/self uniform sampler2D iTex1; // previous uniform int iSeed2; uniform vec3 iGroup2_1[7]; vec4 fx_master(vec3 c0, vec3 c, int seed, vec3 m0) { float fx = magic(m0.xy, vec3(1., 0., 0.), seed); bool invert = magic_trigger(vec3(m0.z, 0., 0.), seed); vec3 c_out = mix(c0, c, fx); c_out = mix(c_out, 1. - c_out, invert ? 1. : 0.); return vec4(c_out, 1.); } vec4 fx_stage(vec2 vUV, sampler2D previous, sampler2D feedback, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3, vec3 m0) { // start vec2 uv0 = vUV.st; float ratio = iResolution.x / iResolution.y; vec2 uv1 = (uv0 - .5) * vec2(ratio, 1.); // controls float ctrl1 = magic(f1, b1, seed + 10.); float ctrl2 = magic(f2, b2, seed + 20.); float ctrl3 = magic(f3, b3, seed + 30.); // logic vec3 c0 = texture(previous, uv0).xyz; vec2 uv2 = uv1; vec3 c = reframe(previous, uv2).xyz; // output return fx_master(c0, c, seed, m0); } void main() { fragColor = fx_stage(vUV, iTex1, iTex0, iSeed2, iGroup2_1[0], iGroup2_1[1].xy, iGroup2_1[2], iGroup2_1[3].xy, iGroup2_1[4], iGroup2_1[5].xy, iGroup2_1[6]); }