diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 4987016..b52189d 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -84,7 +84,7 @@ make -f Makefile.dev release-arch - [x] Use buffers as panels (INA A FXA / DEBUG A+B FXA+B / INB B FXB) - [x] Clean code and fix things - [x] Share openGL state between monitor and screen -- [ ] Default project +- [x] Default project - [x] split with includes - [x] src 9 : sentences repeat h - [x] src 10 : isometric grid @@ -95,10 +95,10 @@ make -f Makefile.dev release-arch - [x] fx 11 : spill - [x] fx 12 : game of life - [x] fx 13 : sobel - - [ ] fx 14 : colorize range (pretty color ranges) + - [x] fx 14 : colorize range (pretty color ranges) - [x] fx 15 : random fx - [x] frag 10 : move debug screen here - - [ ] debug : add src/fx/A/B indicators + - [x] debug : add src/fx/A/B indicators - [ ] Other - [x] `forge_project.cfg` - [x] Define frag prefix in config diff --git a/README.md b/README.md index 6eb5d64..93e2acb 100644 --- a/README.md +++ b/README.md @@ -154,7 +154,7 @@ options: | **3** | **A** | Video In 2 + Thru | _Hue_ | _Saturation_ | _Light_ | Spill | _Bottom limit_ | _Top Limit_ | _Rotation_ | | | **B** | Scales | _Zoom_ | _Shape_ | _Ripples_ | Game Of Life | _Pixel Size_ | _Ruleset/Threshold_ | _Feedback_ | | | **C** | Credenza | _Zoom_ | _Shape_ | _Ripples_ | Sobel Filter | _Horz. filter_ | _Vert. filter_ | _Filter Size_ | -| | **D** | Cursor | _Size_ | _Pos X_ | _Pos Y_ | (same as 0) | | | | +| | **D** | Cursor | _Size_ | _Pos X_ | _Pos Y_ | Isometric | _Zoom_ | _Scroll_ | _Rotate_ | | | **E** | (Random source) | --- | --- | --- | (Random effect) | --- | --- | --- | TODO update diff --git a/default/frag7.glsl b/default/frag7.glsl index 0b28512..132af02 100644 --- a/default/frag7.glsl +++ b/default/frag7.glsl @@ -26,7 +26,7 @@ void main() { float k = mean(color_a); - mix_value = mix(mix_value * 0.9 + 0.05, mix_value, iDemo); + mix_value = mix(mix_value * 0.9 + 0.05, mix_value, 1 - iDemo); fragColor = mix(color_b, color_a, mix_type ? step(mix_value, k) : mix_value); } \ No newline at end of file diff --git a/default/inc_debug.glsl b/default/inc_debug.glsl index cee4291..9938905 100644 --- a/default/inc_debug.glsl +++ b/default/inc_debug.glsl @@ -52,7 +52,25 @@ vec4 debug(vec2 vUV) // inputs int selected_srca = iState3 - 1; + if (selected_srca == 14) { + selected_srca = int(randTime(iSeed3 + 100, 16) * 14); + } + if (selected_srca == 5 && iDemo > 0) { + selected_srca = 1; + } + if (selected_srca == 10 && iDemo > 0) { + selected_srca = 2; + } int selected_srcb = iState4 - 1; + if (selected_srcb == 14) { + selected_srcb = int(randTime(iSeed4 + 100, 16) * 14); + } + if (selected_srcb == 5 && iDemo > 0) { + selected_srcb = 1; + } + if (selected_srcb == 10 && iDemo > 0) { + selected_srcb = 2; + } int selected_fxa = iState5 - 1; int selected_fxb = iState6 - 1; int selected_mfx = iState8 - 1; @@ -67,13 +85,17 @@ vec4 debug(vec2 vUV) // logic - const int texts[6][5] = { + const int texts[10][5] = { {0x46, 0x50, 0x53, 0x00, 0x00}, // FPS {0x54, 0x45, 0x4D, 0x50, 0x4F}, // TEMPO {0x54, 0x49, 0x4D, 0x45, 0x00}, // TIME {0x44, 0x45, 0x4D, 0x4F, 0x00}, // DEMO {0x4C, 0x49, 0x56, 0x45, 0x00}, // LIVE {0x2B, 0x52, 0x41, 0x4E, 0x44}, // +RAND + {0x53, 0x52, 0x43, 0x00, 0x00}, // SRC + {0x46, 0x58, 0x00, 0x00, 0x00}, // FX + {0x49, 0x4E, 0x00, 0x00, 0x00}, // IN + {0x4D, 0x46, 0x58, 0x00, 0x00}, // MFX }; vec2 uv2 = uv1; @@ -126,14 +148,25 @@ vec4 debug(vec2 vUV) f += iActive2 == 2 ? h_rect(uv2, vec2(-2, -3.2), vec2(1, 0), 0.1) : 0; f += iActive2 == 3 ? h_rect(uv2, vec2(5, -1.2), vec2(1, 0), 0.1) : 0; + // show src/fx + + f += write_5(uv3 * 0.75, vec2(-11.6,-1.8), texts[6]); + f += write_5(uv3 * 0.75, vec2(-4.2,-1.8), texts[7]); + f += char_at(uv3 * 0.5, vec2(0.5, 0.5), 0x41); + f += char_at(uv3 * 0.5, vec2(0.5, -3), 0x42); + if (iDemo < 1 && (iInputFormat1 == YUYV_FOURCC || iInputFormat2 == YUYV_FOURCC)) { + f += write_5(uv3 * 0.75, vec2(-19.7,-1.8), texts[8]); + } + f += write_5(uv3 * 0.75, vec2(10.9,2), texts[9]); + // show inputs / feedback float line_a_a = rect(uv2, vec2(-8, 2), vec2(2, 0.1)); float line_a_b = rect(uv2, vec2(-7, 2), vec2(1, 0.1)) + rect(uv2, vec2(-8, 0.5), vec2(0.1, 1.6)) + rect(uv2, vec2(-9, -1), vec2(1, 0.1)); float line_a_f = rect(uv2, vec2(-6.5, 2), vec2(0.5, 0.1)) + rect(uv2, vec2(0, 4), vec2(7, 0.1)) + rect(uv2, vec2(-7, 3), vec2(0.1, 1.1)) + rect(uv2, vec2(7, 2), vec2(0.1, 2.1)); if (selected_srca == 5 && iInputFormat1 == YUYV_FOURCC) { - f += iInputResolution1.x > 0 ? line_a_a : line_a_f; + f += line_a_a; } else if (selected_srca == 10 && iInputFormat2 == YUYV_FOURCC) { - f += iInputResolution2.x > 0 ? line_a_b : line_a_f; + f += line_a_b; } else if (selected_srca % 5 == 0) { f += line_a_f; } @@ -141,9 +174,9 @@ vec4 debug(vec2 vUV) float line_b_b = rect(uv2, vec2(-8, -2), vec2(2, 0.1)); float line_b_f = rect(uv2, vec2(-6.5, -2), vec2(0.5, 0.1)) + rect(uv2, vec2(0, -4), vec2(7, 0.1)) + rect(uv2, vec2(-7, -3), vec2(0.1, 1.1)) + rect(uv2, vec2(7, -2), vec2(0.1, 2.1)); if (selected_srcb == 5 && iInputFormat1 == YUYV_FOURCC) { - f += iInputResolution1.x > 0 ? line_b_a : line_b_f; + f += line_b_a; } else if (selected_srcb == 10 && iInputFormat2 == YUYV_FOURCC) { - f += iInputResolution2.x > 0 ? line_b_b : line_b_f; + f += line_b_b; } else if (selected_srcb % 5 == 0) { f += line_b_f; } diff --git a/default/inc_functions.glsl b/default/inc_functions.glsl index 2548eb5..cae9232 100644 --- a/default/inc_functions.glsl +++ b/default/inc_functions.glsl @@ -79,6 +79,36 @@ vec3 shift3(vec3 c, float f) { return shift(shift(shift(c, f), f), f); } +vec3 mix3(vec3 c1, vec3 c2, vec3 c3, float x) { + return istep(0.5, x) * mix(c1, c2, x * 2) + + step(0.5, x) * mix(c2, c3, x * 2 - 1) + ; +} + +vec3 mix4(vec3 c1, vec3 c2, vec3 c3, vec3 c4, float x) { + return istep(0.333, x) * mix(c1, c2, x * 3) + + step(0.333, x) * istep(0.667, x) * mix(c2, c3, x * 3 - 1) + + step(0.667, x) * mix(c3, c4, x * 3 - 2); + ; +} + +vec3 mix5(vec3 c1, vec3 c2, vec3 c3, vec3 c4, vec3 c5, float x) { + return istep(0.25, x) * mix(c1, c2, x * 4) + + step(0.25, x) * istep(0.5, x) * mix(c2, c3, x * 4 - 1) + + step(0.5, x) * istep(0.75, x) * mix(c3, c4, x * 4 - 2) + + step(0.75, x) * mix(c4, c5, x * 4 - 3) + ; +} + +vec3 mix6(vec3 c1, vec3 c2, vec3 c3, vec3 c4, vec3 c5, vec3 c6, float x) { + return istep(0.2, x) * mix(c1, c2, x * 5) + + step(0.2, x) * istep(0.4, x) * mix(c2, c3, x * 5 - 1) + + step(0.4, x) * istep(0.6, x) * mix(c3, c4, x * 5 - 2) + + step(0.6, x) * istep(0.8, x) * mix(c4, c5, x * 5 - 3) + + step(0.8, x) * mix(c5, c6, x * 5 - 4) + ; +} + float mean(vec3 v) { return v.x * 0.3333 + v.y * 0.3333 + v.z * 0.3333; diff --git a/default/inc_fx.glsl b/default/inc_fx.glsl index 638d691..73879c8 100644 --- a/default/inc_fx.glsl +++ b/default/inc_fx.glsl @@ -487,10 +487,9 @@ subroutine(fx_stage_sub) vec4 fx_13(vec2 vUV, sampler2D previous, sampler2D feed return fx_master(c0, c, seed, m0); } -// TODO FX 14 +// FX 14 : Isometric subroutine(fx_stage_sub) vec4 fx_14(vec2 vUV, sampler2D previous, sampler2D feedback, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3, vec3 m0) { - return fx_1(vUV, previous, feedback, seed, b1, f1, b2, f2, b3, f3, m0); // start vec2 uv0 = vUV.st; @@ -499,10 +498,27 @@ subroutine(fx_stage_sub) vec4 fx_14(vec2 vUV, sampler2D previous, sampler2D feed // controls + float zoom = 1 + magic(f1, b1, seed + 10) * 9; + float h_scroll = magic(f2, b2, seed + 20); + float angle = magic(f3, b3, seed + 30); + // logic vec3 c0 = texture(previous, uv0).xyz; - vec3 c = c0; + + vec2 uv2 = uv1; + + vec2 uv3 = iso(uv2); + + uv3 *= rot(angle); + + uv3 += vec2(h_scroll, 0); + + uv3 *= round(zoom); + + vec2 umax = vec2(round(zoom), 300); + + vec3 c = reframe(previous, mod(uv3, umax)).xyz; return fx_master(c0, c, seed, m0); }