srx 14 : isometric

This commit is contained in:
2025-11-10 00:18:37 +01:00
parent 94d1593e8e
commit 24fe873778
6 changed files with 92 additions and 13 deletions
+1 -1
View File
@@ -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);
}
+38 -5
View File
@@ -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;
}
+30
View File
@@ -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;
+19 -3
View File
@@ -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);
}