refactor: clearer monitor screen

This commit is contained in:
2025-11-17 14:01:34 +01:00
parent 8a14ad52bf
commit 69e34b499c
3 changed files with 102 additions and 60 deletions
+63 -28
View File
@@ -26,7 +26,7 @@ float s(vec2 uv, float x0, float y0) {
step(-y0 - 1, -uv.y); step(-y0 - 1, -uv.y);
} }
const int texts[10][5] = { const int texts[12][5] = {
{0x49, 0x4E, 0x20, 0x41, 0x00}, // IN A {0x49, 0x4E, 0x20, 0x41, 0x00}, // IN A
{0x49, 0x4E, 0x20, 0x42, 0x00}, // IN B {0x49, 0x4E, 0x20, 0x42, 0x00}, // IN B
{0x53, 0x52, 0x43, 0x20, 0x41}, // SRC A {0x53, 0x52, 0x43, 0x20, 0x41}, // SRC A
@@ -37,6 +37,8 @@ const int texts[10][5] = {
{0x4D, 0x46, 0x58, 0x00, 0x00}, // MFX {0x4D, 0x46, 0x58, 0x00, 0x00}, // MFX
{0x46, 0x50, 0x53, 0x00, 0x00}, // FPS {0x46, 0x50, 0x53, 0x00, 0x00}, // FPS
{0x4F, 0x46, 0x46, 0x00, 0x00}, // OFF {0x4F, 0x46, 0x46, 0x00, 0x00}, // OFF
{0x44, 0x45, 0x4D, 0x4F, 0x00}, // DEMO
{0x4C, 0x49, 0x56, 0x45, 0x00}, // LIVE
}; };
void main() { void main() {
@@ -59,46 +61,79 @@ void main() {
c += s(uv2,1,1) * texture(iTex9, uv2); c += s(uv2,1,1) * texture(iTex9, uv2);
c += s(uv2,2,1) * texture(iTex0, uv2); c += s(uv2,2,1) * texture(iTex0, uv2);
float sel = 0;
sel += iSelected == 3 ? h_rect(uv2, vec2(1.5, 2.5), vec2(0.5), 0.01) : 0;
sel += iSelected == 4 ? h_rect(uv2, vec2(1.5, 0.5), vec2(0.5), 0.01) : 0;
sel += iSelected == 5 ? h_rect(uv2, vec2(2.5, 2.5), vec2(0.5), 0.01) : 0;
sel += iSelected == 6 ? h_rect(uv2, vec2(2.5, 0.5), vec2(0.5), 0.01) : 0;
sel += iSelected == 8 ? h_rect(uv2, vec2(2.5, 1.5), vec2(0.5), 0.01) : 0;
c = mix(c, 1 - c, sel);
float f = 0; float f = 0;
float t = 0; float t = 0;
f += rect(uv3, vec2(-51, 28.5), vec2(2.1, 0.7)); f += rect(uv3, vec2(-35, 28.5), vec2(2.1, 0.7));
t += write_5(uv3, vec2(-53,28), texts[0]); t += write_5(uv3, vec2(-37,28), texts[0]);
if (iInputResolution1.x > 0) { if (iInputResolution1.x > 0) {
c += s(uv2,0,2) * texture(iTex3, uv2); c += s(uv2,0,2) * texture(iTex3, uv2);
f += rect(uv3, vec2(-50.4, 26.5), vec2(2.8, 0.7)); f += rect(uv3, vec2(-35, 26.75), vec2(2.8, 0.7));
t += write_int(uv3, vec2(-53,26), iInputFPS1, 2); t += write_int(uv3, vec2(-37.6,26.25), iInputFPS1, 2);
t += write_5(uv3, vec2(-50.5,26), texts[8]); t += write_5(uv3, vec2(-35.1,26.25), texts[8]);
} else { } else {
f += rect(uv3, vec2(-51.5, 26.5), vec2(1.6, 0.7)); f += rect(uv3, vec2(-35, 26.75), vec2(1.6, 0.7));
t += write_5(uv3, vec2(-53,26), texts[9]); t += write_5(uv3, vec2(-36.5,26.25), texts[9]);
} }
f += rect(uv3, vec2(-51, -11.5), vec2(2.1, 0.7)); f += rect(uv3, vec2(-35, -11.5), vec2(2.1, 0.7));
t += write_5(uv3, vec2(-53,-12), texts[1]); t += write_5(uv3, vec2(-37,-12), texts[1]);
if (iInputResolution2.x > 0) { if (iInputResolution2.x > 0) {
c += s(uv2,0,2) * texture(iTex4, uv2); c += s(uv2,0,2) * texture(iTex4, uv2);
f += rect(uv3, vec2(-50.4, -13.5), vec2(2.8, 0.7)); f += rect(uv3, vec2(-35, -13.25), vec2(2.8, 0.7));
t += write_int(uv3, vec2(-53,-14), iInputFPS2, 2); t += write_int(uv3, vec2(-37.6,-13.75), iInputFPS2, 2);
t += write_5(uv3, vec2(-50.5,-14), texts[8]); t += write_5(uv3, vec2(-35.1,-15.75), texts[8]);
} else { } else {
f += rect(uv3, vec2(-51.5, -13.5), vec2(1.6, 0.7)); f += rect(uv3, vec2(-35, -13.25), vec2(1.6, 0.7));
t += write_5(uv3, vec2(-53,-14), texts[9]); t += write_5(uv3, vec2(-36.5,-13.75), texts[9]);
} }
f += rect(uv3, vec2(-14.5, 28.5), vec2(2.6, 0.7));
t += write_5(uv3, vec2(-17,28), texts[2]);
f += rect(uv3, vec2(-14.5, -11.5), vec2(2.6, 0.7));
t += write_5(uv3, vec2(-17,-12), texts[3]);
f += rect(uv3, vec2(21, 28.5), vec2(2.1, 0.7));
t += write_5(uv3, vec2(19,28), texts[4]);
f += rect(uv3, vec2(21, -11.5), vec2(2.1, 0.7));
t += write_5(uv3, vec2(19,-12), texts[5]);
f += rect(uv3, vec2(-15.5, 8.5), vec2(1.6, 0.7));
t += write_5(uv3, vec2(-17,8), texts[6]);
f += rect(uv3, vec2(20.5, 8.5), vec2(1.6, 0.7));
t += write_5(uv3, vec2(19,8), texts[7]);
fragColor = mix(c, vec4(f - t), f); f += rect(uv3, vec2(-35, 8.5), vec2(2.1, 0.7));
if (iDemo > 0) {
t += write_5(uv3, vec2(-37,8), texts[10]);
} else {
t += write_5(uv3, vec2(-37,8), texts[11]);
}
f += rect(uv3, vec2(0, 28.5), vec2(2.6, 0.7));
f += iActive1 == 1 ? h_rect(uv3, vec2(0, 28.5), vec2(3, 1), 0.2) : 0;
t += write_5(uv3, vec2(-2.5,28), texts[2]);
f += rect(uv3, vec2(0, -11.5), vec2(2.6, 0.7));
f += iActive1 == 2 ? h_rect(uv3, vec2(0, -11.5), vec2(3, 1), 0.2) : 0;
t += write_5(uv3, vec2(-2.5,-12), texts[3]);
f += rect(uv3, vec2(35, 28.5), vec2(2.1, 0.7));
f += iActive2 == 1 ? h_rect(uv3, vec2(35, 28.5), vec2(2.5, 1), 0.2) : 0;
t += write_5(uv3, vec2(33,28), texts[4]);
f += rect(uv3, vec2(35, -11.5), vec2(2.1, 0.7));
f += iActive2 == 2 ? h_rect(uv3, vec2(35, -11.5), vec2(2.5, 1), 0.2) : 0;
t += write_5(uv3, vec2(33,-12), texts[5]);
f += rect(uv3, vec2(0, 8.5), vec2(1.6, 0.7));
t += write_5(uv3, vec2(-1.5,8), texts[6]);
f += rect(uv3, vec2(35, 8.5), vec2(1.6, 0.7));
f += iActive2 == 3 ? h_rect(uv3, vec2(35, 8.5), vec2(2, 1), 0.2) : 0;
t += write_5(uv3, vec2(33.5,8), texts[7]);
f += rect(uv3, vec2(35, 6.75), vec2(2.8, 0.7));
t += write_int(uv3, vec2(32.4,6.25), iFPS, 2);
t += write_5(uv3, vec2(34.9,6.25), texts[8]);
fragColor = mix(c, vec4(min(1, f) - t), min(1, f));
} }
+34 -31
View File
@@ -112,7 +112,7 @@ vec4 debug(vec2 vUV)
{0x54, 0x49, 0x4D, 0x45, 0x00}, // TIME {0x54, 0x49, 0x4D, 0x45, 0x00}, // TIME
{0x44, 0x45, 0x4D, 0x4F, 0x00}, // DEMO {0x44, 0x45, 0x4D, 0x4F, 0x00}, // DEMO
{0x4C, 0x49, 0x56, 0x45, 0x00}, // LIVE {0x4C, 0x49, 0x56, 0x45, 0x00}, // LIVE
{0x2B, 0x52, 0x41, 0x4E, 0x44}, // +RAND {0x52, 0x41, 0x4E, 0x44, 0x00}, // RAND
{0x53, 0x52, 0x43, 0x00, 0x00}, // SRC {0x53, 0x52, 0x43, 0x00, 0x00}, // SRC
{0x46, 0x58, 0x00, 0x00, 0x00}, // FX {0x46, 0x58, 0x00, 0x00, 0x00}, // FX
{0x49, 0x4E, 0x00, 0x00, 0x00}, // IN {0x49, 0x4E, 0x00, 0x00, 0x00}, // IN
@@ -142,8 +142,17 @@ vec4 debug(vec2 vUV)
rect(uv2, vec2(2, -1.55), vec2(0.1, 0.55)) + rect(uv2, vec2(2, -1.55), vec2(0.1, 0.55)) +
rect(uv2, vec2(0.55, 2), vec2(1.5, 0.1)) + rect(uv2, vec2(0.55, 2), vec2(1.5, 0.1)) +
rect(uv2, vec2(2, 1.55), vec2(0.1, 0.55)) + rect(uv2, vec2(2, 1.55), vec2(0.1, 0.55)) +
rect(uv2, vec2(7.5, 0), vec2(1.5, 0.1)) + rect(uv2, vec2(6.8, 0), vec2(0.75, 0.1)) +
h_rect(uv2, vec2(-9, -3.9), vec2(1), 0.1); h_circle(uv2, vec2(7.8, 0), 0.3, 0.1)
;
if (iDemo < 1 && iInputFormat1 == YUYV_FOURCC) {
f += circle(uv2, vec2(-9, 2), 0.3);
}
if (iDemo < 1 && iInputFormat2 == YUYV_FOURCC) {
f += circle(uv2, vec2(-9, -2), 0.3);
}
// show selected src/fx // show selected src/fx
f += char_at(uv2, vec2(-5.4, 1.45), hex_chars[selected_srca]); f += char_at(uv2, vec2(-5.4, 1.45), hex_chars[selected_srca]);
@@ -178,17 +187,17 @@ vec4 debug(vec2 vUV)
f += write_5(uv3 * 0.75, vec2(-11.6,-1.8), texts[6]); 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 += 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(-11.5, 3.5), 0x41);
f += char_at(uv3 * 0.5, vec2(0.5, -3), 0x42); f += char_at(uv3 * 0.5, vec2(-11.5, -6), 0x42);
if (iDemo < 1 && (iInputFormat1 == YUYV_FOURCC || iInputFormat2 == YUYV_FOURCC)) { 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(-19.7,-1.8), texts[8]);
} }
f += write_5(uv3 * 0.75, vec2(10.9,2), texts[9]); f += write_5(uv3 * 0.75, vec2(10.9,2), texts[9]);
// show inputs / feedback // show inputs / feedback
float line_a_a = rect(uv2, vec2(-8, 2), vec2(2, 0.1)); float line_a_a = rect(uv2, vec2(-7.5, 2), vec2(1.5, 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_b = rect(uv2, vec2(-6.5, 2), vec2(0.5, 0.1)) + rect(uv2, vec2(-8.5, -2), vec2(0.5, 0.1)) + line(uv2, vec2(-7, 2.1), vec2(-8, -2.1), 0.2);
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)); float line_a_f = rect(uv2, vec2(-6.5, 2), vec2(0.5, 0.1)) + rect(uv2, vec2(0, 3.6), vec2(7, 0.1)) + rect(uv2, vec2(-7, 2.8), vec2(0.1, 0.9)) + rect(uv2, vec2(7, 1.8), vec2(0.1, 1.9));
if (selected_srca == 5 && iInputFormat1 == YUYV_FOURCC) { if (selected_srca == 5 && iInputFormat1 == YUYV_FOURCC) {
f += line_a_a; f += line_a_a;
} else if (selected_srca == 10 && iInputFormat2 == YUYV_FOURCC) { } else if (selected_srca == 10 && iInputFormat2 == YUYV_FOURCC) {
@@ -196,9 +205,10 @@ vec4 debug(vec2 vUV)
} else if (selected_srca % 5 == 0) { } else if (selected_srca % 5 == 0) {
f += line_a_f; f += line_a_f;
} }
float line_b_a = rect(uv2, vec2(-6.5, -2), vec2(0.5, 0.1)) + rect(uv2, vec2(-7, -0.5), vec2(0.1, 1.6)) + rect(uv2, vec2(-8.5, 1), vec2(1.5, 0.1));
float line_b_b = rect(uv2, vec2(-8, -2), vec2(2, 0.1)); float line_b_a = rect(uv2, vec2(-6.5, -2), vec2(0.5, 0.1)) + rect(uv2, vec2(-8.5, 2), vec2(0.5, 0.1)) + line(uv2, vec2(-7, -2.1), vec2(-8, 2.1), 0.2);
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)); float line_b_b = rect(uv2, vec2(-8, -2), vec2(1, 0.1));
float line_b_f = rect(uv2, vec2(-6.5, -2), vec2(0.5, 0.1)) + rect(uv2, vec2(0, -3.6), vec2(7, 0.1)) + rect(uv2, vec2(-7, -2.8), vec2(0.1, 0.9)) + rect(uv2, vec2(7, -1.8), vec2(0.1, 1.9));
if (selected_srcb == 5 && iInputFormat1 == YUYV_FOURCC) { if (selected_srcb == 5 && iInputFormat1 == YUYV_FOURCC) {
f += line_b_a; f += line_b_a;
} else if (selected_srcb == 10 && iInputFormat2 == YUYV_FOURCC) { } else if (selected_srcb == 10 && iInputFormat2 == YUYV_FOURCC) {
@@ -208,7 +218,9 @@ vec4 debug(vec2 vUV)
} }
// show page // show page
f += char_at(uv2, vec2(-9.2, -4.3), hex_chars[iPage]); f += iPage == 0 ? circle(uv2, vec2(-0.75, -4.1), 0.3) : h_circle(uv2, vec2(-0.75, -4.1), 0.25, 0.1);
f += iPage == 1 ? circle(uv2, vec2(0, -4.1), 0.3) : h_circle(uv2, vec2(0, -4.1), 0.20, 0.1);
f += iPage == 2 ? circle(uv2, vec2(0.75, -4.1), 0.3) : h_circle(uv2, vec2(0.75, -4.1), 0.20, 0.1);
// show fx values // show fx values
float fx_rect = 0; float fx_rect = 0;
@@ -226,34 +238,25 @@ vec4 debug(vec2 vUV)
float x = 0; float x = 0;
x = -15; x = -15;
f += write_5(uv3, vec2(x - 4,13), texts[0]); f += write_5(uv3, vec2(x - 4.5,13), texts[1]);
f += write_int(uv3, vec2(x + 1, 13), iFPS, 3); f += write_int(uv3, vec2(x + 1.5,13), int(iTempo), 3);
v = min(1, iFPS/30.0);
f += h_rect(uv3, vec2(x, 12), vec2(4, 0.5), 0.2);
f += rect(uv3, vec2(x + 4 * v - 4, 12), vec2(4 * v, 0.4));
x = 0;
f += write_5(uv3, vec2(x - 4,13), texts[1]);
f += write_int(uv3, vec2(x + 1,13), int(iTempo), 3);
v = fract(iBeats); v = fract(iBeats);
f += h_rect(uv3, vec2(x, 12), vec2(4, 0.5), 0.2); f += h_rect(uv3, vec2(x, 12), vec2(4, 0.5), 0.2);
f += rect(uv3, vec2(x + 4 * v - 4, 12), vec2(4 * v, 0.4)); f += rect(uv3, vec2(x + 4 * v - 4, 12), vec2(4 * v, 0.4));
x = 15; x = 15;
f += write_5(uv3, vec2(x - 4,13), texts[2]); if (iAutoRand > 0) {
f += write_int(uv3, vec2(x - 1,13), int(iTime), 5); f += write_5(uv3, vec2(x - 4.5,13), texts[5]);
f += write_int(uv3, vec2(x - 0.5,13), int(iAutoRandCycle), 5);
v = fract(iBeats / iAutoRandCycle);
} else {
f += write_int(uv3, vec2(x - 0.5,13), int(iTime), 5);
v = fract(iTime); v = fract(iTime);
f += write_5(uv3, vec2(x - 4.5,13), texts[2]);
}
f += h_rect(uv3, vec2(x, 12), vec2(4, 0.5), 0.2); f += h_rect(uv3, vec2(x, 12), vec2(4, 0.5), 0.2);
f += rect(uv3, vec2(x + 4 * v - 4, 12), vec2(4 * v, 0.4)); f += rect(uv3, vec2(x + 4 * v - 4, 12), vec2(4 * v, 0.4));
if (iAutoRand > 0) {
f += write_5(uv3, vec2(-4,-15), iDemo > 0 ? texts[3] : texts[4]);
f += write_5(uv3, vec2(0,-15), texts[5]);
f += write_int_left(uv3, vec2(3, -15), iAutoRandCycle, 3);
} else {
f += write_5(uv3, vec2(-2,-15), iDemo > 0 ? texts[3] : texts[4]);
}
return vec4(f); return vec4(f);
} }
+4
View File
@@ -226,6 +226,10 @@ float circle(vec2 uv, vec2 c, float size) {
return istep(size, length(uv - c)); return istep(size, length(uv - c));
} }
float h_circle(vec2 uv, vec2 c, float size, float k) {
return circle(uv, c, size + k * 0.5) - circle(uv, c, size - k * 0.5);
}
float stripe(float x, float k1, float k2) float stripe(float x, float k1, float k2)
{ {
return k2 > k1 ? (1 - step(x, k1)) * (step(x, k2)) : ((1 - step(x, k2)) * (step(x, k1))); return k2 > k1 ? (1 - step(x, k1)) * (step(x, k2)) : ((1 - step(x, k2)) * (step(x, k1)));