5 Commits
Author SHA1 Message Date
klemek 2843e5e863 fix: better full-clean 2026-05-16 00:36:28 +02:00
klemek 433cf61a91 forge (steel) v1.1.1
Clang Build CI / run-no-video (push) Successful in 1m18s
Clang Build CI / build-release (push) Successful in 1m30s
Clang Build CI / run-video (push) Successful in 1m26s
Clang Lint CI / lint-no-video (push) Successful in 1m22s
Clang Lint CI / lint-video (push) Successful in 1m17s
2026-05-16 00:33:24 +02:00
klemek fe3316f730 feat: better src 4 2026-05-16 00:32:41 +02:00
klemek 96f97d81df fix: update default project with internal buffer swap 2026-05-15 16:36:57 +02:00
klemek 365fee352e tools: better clean 2026-05-15 00:24:16 +02:00
18 changed files with 344 additions and 243 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ build build project into build/forge
run run project with test args run run project with test args
demo run project with demo mode demo run project with demo mode
valgrind valgrind analysis valgrind valgrind analysis
clean-release remove autoconf/automake files full-clean remove build files and untracked files
test-release try to build release test-release try to build release
release-% make full release of version % release-% make full release of version %
release-arch make arch-linux release package release-arch make arch-linux release package
+14 -9
View File
@@ -7,7 +7,7 @@ SHELL := /bin/bash
clean: clean:
@rm -rf build @rm -rf build
build: build/$(TARGET):
@mkdir -p build @mkdir -p build
gcc \ gcc \
src/*.h src/*.c \ src/*.h src/*.c \
@@ -25,6 +25,9 @@ build:
-o build/$(TARGET) \ -o build/$(TARGET) \
-g -Og -g -Og
.PHONY: build
build: build/$(TARGET)
.PHONY: build-no-video .PHONY: build-no-video
build-no-video: build-no-video:
@mkdir -p build @mkdir -p build
@@ -48,26 +51,28 @@ format:
clang-format -i src/* clang-format -i src/*
.PHONY: run .PHONY: run
run: build run: build/$(TARGET)
./build/$(TARGET) $(RUN_ARGS) ./build/$(TARGET) $(RUN_ARGS)
.PHONY: sample .PHONY: sample
sample: build sample: build/$(TARGET)
./build/$(TARGET) --project=sample ./build/$(TARGET) --project=sample $(RUN_ARGS)
.PHONY: valgrind .PHONY: valgrind
valgrind: build valgrind: build/$(TARGET)
valgrind \ valgrind \
--show-realloc-size-zero=no \ --show-realloc-size-zero=no \
--undef-value-errors=no \ --undef-value-errors=no \
./build/$(TARGET) $(RUN_ARGS) ./build/$(TARGET) $(RUN_ARGS)
.PHONY: clean-release .PHONY: full-clean
clean-release: full-clean:
git clean -f -x git clean -f -x
rm -rf */*/.deps
rm -rf */.deps
.PHONY: test-release .PHONY: test-release
test-release: clean clean-release test-release: clean full-clean
aclocal aclocal
autoconf autoconf
automake --add-missing automake --add-missing
@@ -77,7 +82,7 @@ test-release: clean clean-release
cp $(TARGET)-steel-*.tar.gz build/ cp $(TARGET)-steel-*.tar.gz build/
.PHONY: release-% .PHONY: release-%
release-%: clean clean-release release-%: clean full-clean
git pull origin main git pull origin main
sed -i -E "s/[0-9]+\\.[0-9]+\\.[0-9]+/$*/g" configure.ac sed -i -E "s/[0-9]+\\.[0-9]+\\.[0-9]+/$*/g" configure.ac
aclocal aclocal
+2 -2
View File
@@ -1,12 +1,12 @@
pkgname=forge-steel pkgname=forge-steel
pkgver=1.1.0 pkgver=1.1.1
pkgrel=1 pkgrel=1
pkgdesc="Fusion Of Real Time Generative Effects" pkgdesc="Fusion Of Real Time Generative Effects"
arch=('i686' 'pentium4' 'x86_64' 'arm' 'armv7h' 'armv6h' 'aarch64' 'riscv64') arch=('i686' 'pentium4' 'x86_64' 'arm' 'armv7h' 'armv6h' 'aarch64' 'riscv64')
depends=('glfw>=1:3', 'v4l-utils>=1.32', 'alsa-lib>=1.2', 'libglvnd>=1.7') depends=('glfw>=1:3', 'v4l-utils>=1.32', 'alsa-lib>=1.2', 'libglvnd>=1.7')
url="https://git.klemek.fr/klemek/forge-steel" url="https://git.klemek.fr/klemek/forge-steel"
source=("${pkgname}-steel-${pkgver}.tar.gz::https://git.klemek.fr/klemek/forge-steel/releases/download/v${pkgver}/${pkgname}-${pkgver}.tar.gz") source=("${pkgname}-steel-${pkgver}.tar.gz::https://git.klemek.fr/klemek/forge-steel/releases/download/v${pkgver}/${pkgname}-${pkgver}.tar.gz")
sha256sums=('794fb0f170cff19872acfba8a556e2a08c55a78e497ac0b330eca6db65343529') sha256sums=('7b518ac91de1ecacb34da3f52a06ae82b26a287512cbf43ba5dd7d39e35b8d8f')
srcdir=build srcdir=build
backup=("usr/share/${pkgname}") backup=("usr/share/${pkgname}")
+1 -1
View File
@@ -247,7 +247,7 @@ Working with pages and items, you can use the following predefined sources and e
| **1** | **0** | Feedback + Thru | _Hue_ | _Saturation_ | _Light_ | Thru | _Hue_ | _Saturation_ | _Light_ | | **1** | **0** | Feedback + Thru | _Hue_ | _Saturation_ | _Light_ | Thru | _Hue_ | _Saturation_ | _Light_ |
| | **1** | Lines | _Thick. / Dezoom_ | _Rotation_ | _Distortion_ | Feedback + Shift | _Zoom / Dezoom_ | _X Shift_ | _Y Shift_ | | | **1** | Lines | _Thick. / Dezoom_ | _Rotation_ | _Distortion_ | Feedback + Shift | _Zoom / Dezoom_ | _X Shift_ | _Y Shift_ |
| | **2** | Dots | _Zoom_ | _Rotation_ | _Lens_ | Shift | _Zoom / Dezoom_ | _X Shift_ | _Y Shift_ | | | **2** | Dots | _Zoom_ | _Rotation_ | _Lens_ | Shift | _Zoom / Dezoom_ | _X Shift_ | _Y Shift_ |
| | **3** | Circuit | _Zoom_ | _H. connect_ | _V. connect_ | Colorize | _Black Color_ | _White Color_ | _Shift_ | | | **3** | Bacteria | _Zoom_ | _Details_ | _Delta details_ | Colorize | _Black Color_ | _White Color_ | _Shift_ |
| | **4** | Noise | _Zoom_ | _Voronoi dist._ | _Details_ | Quantize | _Pixel Size_ | _Bit Depth_ | _Blur_ | | | **4** | Noise | _Zoom_ | _Voronoi dist._ | _Details_ | Quantize | _Pixel Size_ | _Bit Depth_ | _Blur_ |
| **2** | **5** | Video In 1 + Thru | _Hue_ | _Saturation_ | _Light_ | Dithering | _Pixel Size_ | _Bit Depth_ | _Blur_ | | **2** | **5** | Video In 1 + Thru | _Hue_ | _Saturation_ | _Light_ | Dithering | _Pixel Size_ | _Bit Depth_ | _Blur_ |
| | **6** | CP437 | _Zoom_ | _Charset_ | _Char. Delta_ | TV | _Lens_ | _Horz. Noise_ | _Dezoom_ | | | **6** | CP437 | _Zoom_ | _Charset_ | _Char. Delta_ | TV | _Lens_ | _Horz. Noise_ | _Dezoom_ |
+1 -1
View File
@@ -1,4 +1,4 @@
AC_INIT([forge], [steel-1.1.0], [klemek.dev@proton.me]) AC_INIT([forge], [steel-1.1.1], [klemek.dev@proton.me])
AM_INIT_AUTOMAKE AM_INIT_AUTOMAKE
AC_PROG_CC AC_PROG_CC
+7 -7
View File
@@ -115,13 +115,13 @@ FRAG_FILE_PREFIX=frag
FRAG_COUNT=10 FRAG_COUNT=10
# To which texture will the shader fragX.glsl will render to # To which texture will the shader fragX.glsl will render to
FRAG_1_OUT=5 FRAG_1_OUT=3
FRAG_2_OUT=6 FRAG_2_OUT=4
FRAG_3_OUT=7 FRAG_3_OUT=5
FRAG_4_OUT=8 FRAG_4_OUT=6
FRAG_5_OUT=9 FRAG_5_OUT=7
FRAG_6_OUT=10 FRAG_6_OUT=8
FRAG_7_OUT=11 FRAG_7_OUT=9
FRAG_8_OUT=0 FRAG_8_OUT=0
# Which fragment shader renders to output window # Which fragment shader renders to output window
FRAG_OUTPUT=9 FRAG_OUTPUT=9
+3 -8
View File
@@ -2,8 +2,8 @@
// VIDEO 1 // VIDEO 1
// ----------- // -----------
// IN: 1+3 (RAW IN A) // IN: 1 (RAW IN A)
// OUT: 5 (IN A) // OUT: 3 (IN A)
in vec2 vUV; in vec2 vUV;
out vec4 fragColor; out vec4 fragColor;
@@ -14,16 +14,11 @@ uniform sampler2D iTex0;
uniform sampler2D iTex1; uniform sampler2D iTex1;
uniform sampler2D iTex3; uniform sampler2D iTex3;
uniform int iInputFormat1; uniform int iInputFormat1;
uniform int iInputSwap1;
uniform vec2 iInputResolution1; uniform vec2 iInputResolution1;
void main() { void main() {
if (iInputFormat1 == YUYV_FOURCC) { if (iInputFormat1 == YUYV_FOURCC) {
if (iInputSwap1 > 0) { fragColor = yuyvTex(iTex1, vUV, int(iInputResolution1.x));
fragColor = yuyvTex(iTex3, vUV, int(iInputResolution1.x));
} else {
fragColor = yuyvTex(iTex1, vUV, int(iInputResolution1.x));
}
} else { } else {
fragColor = texture(iTex0, vUV); fragColor = texture(iTex0, vUV);
} }
+94 -22
View File
@@ -9,13 +9,13 @@ out vec4 fragColor;
#include inc_debug.glsl #include inc_debug.glsl
uniform sampler2D iTex0; uniform sampler2D iTex0;
uniform sampler2D iTex3;
uniform sampler2D iTex4;
uniform sampler2D iTex5; uniform sampler2D iTex5;
uniform sampler2D iTex6; uniform sampler2D iTex6;
uniform sampler2D iTex7; uniform sampler2D iTex7;
uniform sampler2D iTex8; uniform sampler2D iTex8;
uniform sampler2D iTex9; uniform sampler2D iTex9;
uniform sampler2D iTex10;
uniform sampler2D iTex11;
uniform int iFPS; uniform int iFPS;
uniform int iInputFPS1; uniform int iInputFPS1;
uniform int iInputFPS2; uniform int iInputFPS2;
@@ -26,19 +26,91 @@ float s(vec2 uv, float x0, float y0) {
} }
const int texts[12][5] = { const int texts[12][5] = {
{0x49, 0x4E, 0x20, 0x41, 0x00}, // IN A {
{0x49, 0x4E, 0x20, 0x42, 0x00}, // IN B 0x49,
{0x53, 0x52, 0x43, 0x20, 0x41}, // SRC A 0x4E,
{0x53, 0x52, 0x43, 0x20, 0x42}, // SRC B 0x20,
{0x46, 0x58, 0x20, 0x41, 0x00}, // FX A 0x41,
{0x46, 0x58, 0x20, 0x42, 0x00}, // FX B 0x00
{0x41, 0x2B, 0x42, 0x00, 0x00}, // A+B }, // IN A
{0x4D, 0x46, 0x58, 0x00, 0x00}, // MFX {
{0x46, 0x50, 0x53, 0x00, 0x00}, // FPS 0x49,
{0x4F, 0x46, 0x46, 0x00, 0x00}, // OFF 0x4E,
{0x44, 0x45, 0x4D, 0x4F, 0x00}, // DEMO 0x20,
{0x4C, 0x49, 0x56, 0x45, 0x00}, // LIVE 0x42,
}; 0x00
}, // IN B
{
0x53,
0x52,
0x43,
0x20,
0x41
}, // SRC A
{
0x53,
0x52,
0x43,
0x20,
0x42
}, // SRC B
{
0x46,
0x58,
0x20,
0x41,
0x00
}, // FX A
{
0x46,
0x58,
0x20,
0x42,
0x00
}, // FX B
{
0x41,
0x2B,
0x42,
0x00,
0x00
}, // A+B
{
0x4D,
0x46,
0x58,
0x00,
0x00
}, // MFX
{
0x46,
0x50,
0x53,
0x00,
0x00
}, // FPS
{
0x4F,
0x46,
0x46,
0x00,
0x00
}, // OFF
{
0x44,
0x45,
0x4D,
0x4F,
0x00
}, // DEMO
{
0x4C,
0x49,
0x56,
0x45,
0x00
}, // LIVE
};
void main() { void main() {
vec2 uv0 = vUV.st; vec2 uv0 = vUV.st;
@@ -50,14 +122,14 @@ void main() {
vec4 c = vec4(0); vec4 c = vec4(0);
c += s(uv2, 1, 2) * texture(iTex7, uv2); c += s(uv2, 1, 2) * texture(iTex5, uv2);
c += s(uv2, 2, 2) * texture(iTex9, uv2); c += s(uv2, 2, 2) * texture(iTex7, uv2);
c += s(uv2, 1, 0) * texture(iTex8, uv2); c += s(uv2, 1, 0) * texture(iTex6, uv2);
c += s(uv2, 2, 0) * texture(iTex10, uv2); c += s(uv2, 2, 0) * texture(iTex8, uv2);
c += s(uv2, 0, 1) * debug(mod(uv2, 1)); c += s(uv2, 0, 1) * debug(mod(uv2, 1));
c += s(uv2, 1, 1) * texture(iTex11, 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; float sel = 0;
@@ -77,7 +149,7 @@ void main() {
t += write_5(uv3, vec2(-37, 28), texts[0]); t += write_5(uv3, vec2(-37, 28), texts[0]);
if (iInputFormat1 == YUYV_FOURCC) { if (iInputFormat1 == YUYV_FOURCC) {
c += s(uv2, 0, 2) * texture(iTex5, uv2); c += s(uv2, 0, 2) * texture(iTex3, uv2);
f += rect(uv3, vec2(-35, 26.75), vec2(2.8, 0.7)); f += rect(uv3, vec2(-35, 26.75), vec2(2.8, 0.7));
t += write_int(uv3, vec2(-37.6, 26.1), iInputFPS1, 2); t += write_int(uv3, vec2(-37.6, 26.1), iInputFPS1, 2);
t += write_5(uv3, vec2(-35.1, 26.1), texts[8]); t += write_5(uv3, vec2(-35.1, 26.1), texts[8]);
@@ -90,7 +162,7 @@ void main() {
t += write_5(uv3, vec2(-37, -12), texts[1]); t += write_5(uv3, vec2(-37, -12), texts[1]);
if (iInputFormat2 == YUYV_FOURCC) { if (iInputFormat2 == YUYV_FOURCC) {
c += s(uv2, 0, 0) * texture(iTex6, uv2); c += s(uv2, 0, 0) * texture(iTex4, uv2);
f += rect(uv3, vec2(-35, -13.25), vec2(2.8, 0.7)); f += rect(uv3, vec2(-35, -13.25), vec2(2.8, 0.7));
t += write_int(uv3, vec2(-37.6, -13.9), iInputFPS2, 2); t += write_int(uv3, vec2(-37.6, -13.9), iInputFPS2, 2);
t += write_5(uv3, vec2(-35.1, -13.9), texts[8]); t += write_5(uv3, vec2(-35.1, -13.9), texts[8]);
+3 -8
View File
@@ -2,8 +2,8 @@
// VIDEO 2 // VIDEO 2
// ----------- // -----------
// IN: 2+4 (RAW IN B) // IN: 2 (RAW IN B)
// OUT: 6 (IN B) // OUT: 4 (IN B)
in vec2 vUV; in vec2 vUV;
out vec4 fragColor; out vec4 fragColor;
@@ -14,16 +14,11 @@ uniform sampler2D iTex0;
uniform sampler2D iTex2; uniform sampler2D iTex2;
uniform sampler2D iTex4; uniform sampler2D iTex4;
uniform int iInputFormat2; uniform int iInputFormat2;
uniform int iInputSwap2;
uniform vec2 iInputResolution2; uniform vec2 iInputResolution2;
void main() { void main() {
if (iInputFormat2 == YUYV_FOURCC) { if (iInputFormat2 == YUYV_FOURCC) {
if (iInputSwap2 > 0) { fragColor = yuyvTex(iTex2, vUV, int(iInputResolution2.x));
fragColor = yuyvTex(iTex4, vUV, int(iInputResolution2.x));
} else {
fragColor = yuyvTex(iTex2, vUV, int(iInputResolution2.x));
}
} else { } else {
fragColor = texture(iTex0, vUV); fragColor = texture(iTex0, vUV);
} }
+1 -1
View File
@@ -3,7 +3,7 @@
// SRC A // SRC A
// ----------- // -----------
// OUT: 7 (FX A) // OUT: 5 (FX A)
in vec2 vUV; in vec2 vUV;
out vec4 fragColor; out vec4 fragColor;
+1 -1
View File
@@ -2,7 +2,7 @@
// SRC B // SRC B
// ----------- // -----------
// OUT: 8 (FX B) // OUT: 6 (FX B)
in vec2 vUV; in vec2 vUV;
out vec4 fragColor; out vec4 fragColor;
+5 -5
View File
@@ -2,20 +2,20 @@
// FX A // FX A
// ------------- // -------------
// IN: 7 (SRC A) // IN: 5 (SRC A)
// IN: 9 (FX A) // IN: 7 (FX A)
// OUT: 9 (A+B) // OUT: 7 (A+B)
in vec2 vUV; in vec2 vUV;
out vec4 fragColor; out vec4 fragColor;
#include inc_fx.glsl #include inc_fx.glsl
uniform sampler2D iTex5;
uniform sampler2D iTex7; uniform sampler2D iTex7;
uniform sampler2D iTex9;
uniform int iSeed5; uniform int iSeed5;
uniform vec3 iGroup2_1[7]; uniform vec3 iGroup2_1[7];
void main() { void main() {
fragColor = fx_stage(vUV, iTex7, iTex9, iSeed5, iGroup2_1[0], iGroup2_1[1].xy, iGroup2_1[2], iGroup2_1[3].xy, iGroup2_1[4], iGroup2_1[5].xy, iGroup2_1[6]); fragColor = fx_stage(vUV, iTex5, iTex7, iSeed5, iGroup2_1[0], iGroup2_1[1].xy, iGroup2_1[2], iGroup2_1[3].xy, iGroup2_1[4], iGroup2_1[5].xy, iGroup2_1[6]);
} }
+5 -5
View File
@@ -2,20 +2,20 @@
// FX B // FX B
// ------------- // -------------
// IN: 8 (SRC B) // IN: 6 (SRC B)
// IN: 10 (FX B) // IN: 8 (FX B)
// OUT: 10 (A+B) // OUT: 8 (A+B)
in vec2 vUV; in vec2 vUV;
out vec4 fragColor; out vec4 fragColor;
#include inc_fx.glsl #include inc_fx.glsl
uniform sampler2D iTex6;
uniform sampler2D iTex8; uniform sampler2D iTex8;
uniform sampler2D iTex10;
uniform int iSeed6; uniform int iSeed6;
uniform vec3 iGroup2_2[7]; uniform vec3 iGroup2_2[7];
void main() { void main() {
fragColor = fx_stage(vUV, iTex8, iTex10, iSeed6, iGroup2_2[0], iGroup2_2[1].xy, iGroup2_2[2], iGroup2_2[3].xy, iGroup2_2[4], iGroup2_2[5].xy, iGroup2_2[6]); fragColor = fx_stage(vUV, iTex6, iTex8, iSeed6, iGroup2_2[0], iGroup2_2[1].xy, iGroup2_2[2], iGroup2_2[3].xy, iGroup2_2[4], iGroup2_2[5].xy, iGroup2_2[6]);
} }
+7 -7
View File
@@ -2,9 +2,9 @@
// A+B // A+B
// ------------ // ------------
// IN: 9 (FX A) // IN: 7 (FX A)
// IN: 10 (FX B) // IN: 8 (FX B)
// OUT: 11 (MFX) // OUT: 9 (MFX)
in vec2 vUV; in vec2 vUV;
out vec4 fragColor; out vec4 fragColor;
@@ -13,8 +13,8 @@ out vec4 fragColor;
#include inc_functions.glsl #include inc_functions.glsl
uniform int iDemo; uniform int iDemo;
uniform sampler2D iTex9; uniform sampler2D iTex7;
uniform sampler2D iTex10; uniform sampler2D iTex8;
uniform int iSeed7; uniform int iSeed7;
uniform vec3 iGroup3_1[2]; uniform vec3 iGroup3_1[2];
@@ -22,8 +22,8 @@ void main() {
float mix_value = magic(iGroup3_1[1].xy, vec3(1, 0, 0), iSeed7); float mix_value = magic(iGroup3_1[1].xy, vec3(1, 0, 0), iSeed7);
bool mix_type = magic_trigger(vec3(iGroup3_1[0].x, 0, 0), iSeed7 + 10); bool mix_type = magic_trigger(vec3(iGroup3_1[0].x, 0, 0), iSeed7 + 10);
vec4 color_a = texture(iTex9, vUV); vec4 color_a = texture(iTex7, vUV);
vec4 color_b = texture(iTex10, vUV); vec4 color_b = texture(iTex8, vUV);
float k = mean(color_a); float k = mean(color_a);
+3 -3
View File
@@ -2,7 +2,7 @@
// MFX // MFX
// ------------ // ------------
// IN: 11 (A+B) // IN: 9 (A+B)
// IN: 0 (OUT) // IN: 0 (OUT)
// OUT: 0 (OUT) // OUT: 0 (OUT)
@@ -11,7 +11,7 @@ out vec4 fragColor;
#include inc_fx.glsl #include inc_fx.glsl
uniform sampler2D iTex11; uniform sampler2D iTex9;
uniform sampler2D iTex0; uniform sampler2D iTex0;
uniform int iSeed8; uniform int iSeed8;
uniform vec3 iGroup2_3[7]; uniform vec3 iGroup2_3[7];
@@ -20,7 +20,7 @@ uniform int iDemo;
uniform int iAutoRand; uniform int iAutoRand;
void main() { void main() {
vec4 color = fx_stage(vUV, iTex11, iTex0, iSeed8, iGroup2_3[0], iGroup2_3[1].xy, iGroup2_3[2], iGroup2_3[3].xy, iGroup2_3[4], iGroup2_3[5].xy, iGroup2_3[6]); vec4 color = fx_stage(vUV, iTex9, iTex0, iSeed8, iGroup2_3[0], iGroup2_3[1].xy, iGroup2_3[2], iGroup2_3[3].xy, iGroup2_3[4], iGroup2_3[5].xy, iGroup2_3[6]);
if (iDemo < 1 && iAutoRand < 1) { if (iDemo < 1 && iAutoRand < 1) {
color = mix(color, vec4(0), iGroup3_1[0].y); color = mix(color, vec4(0), iGroup3_1[0].y);
+55 -49
View File
@@ -24,48 +24,48 @@ float iestep(float x, float y) {
} }
float ease(float x) { float ease(float x) {
return 0.5 - cos(max(min(x, 1.0), 0.0)*PI) * 0.5; return 0.5 - cos(max(min(x, 1.0), 0.0) * PI) * 0.5;
} }
vec2 ease(vec2 x) { vec2 ease(vec2 x) {
return 0.5 - cos(max(min(x, 1.0), 0.0)*PI) * 0.5; return 0.5 - cos(max(min(x, 1.0), 0.0) * PI) * 0.5;
} }
vec3 ease(vec3 x) { vec3 ease(vec3 x) {
return 0.5 - cos(max(min(x, 1.0), 0.0)*PI) * 0.5; return 0.5 - cos(max(min(x, 1.0), 0.0) * PI) * 0.5;
} }
float saw(float x){ float saw(float x) {
return abs(mod(x+1,2)-1); return abs(mod(x + 1, 2) - 1);
} }
vec2 saw(vec2 x){ vec2 saw(vec2 x) {
return abs(mod(x+1,2)-1); return abs(mod(x + 1, 2) - 1);
} }
vec3 saw(vec3 x){ vec3 saw(vec3 x) {
return abs(mod(x+1,2)-1); return abs(mod(x + 1, 2) - 1);
} }
float cmod(float x, float k){ float cmod(float x, float k) {
return mod(x + k * 0.5, k) - k * 0.5; return mod(x + k * 0.5, k) - k * 0.5;
} }
vec2 cmod(vec2 x, float k){ vec2 cmod(vec2 x, float k) {
return mod(x + k * 0.5, k) - k * 0.5; return mod(x + k * 0.5, k) - k * 0.5;
} }
vec3 cmod(vec3 x, float k){ vec3 cmod(vec3 x, float k) {
return mod(x + k * 0.5, k) - k * 0.5; return mod(x + k * 0.5, k) - k * 0.5;
} }
// COLORS // COLORS
vec3 col(float x){ vec3 col(float x) {
return vec3( return vec3(
.5*(sin(x*2.*PI)+1.), .5 * (sin(x * 2. * PI) + 1.),
.5*(sin(x*2.*PI+2.*PI/3.)+1.), .5 * (sin(x * 2. * PI + 2. * PI / 3.) + 1.),
.5*(sin(x*2.*PI-2.*PI/3.)+1.) .5 * (sin(x * 2. * PI - 2. * PI / 3.) + 1.)
); );
} }
@@ -83,8 +83,7 @@ vec3 shift3(vec3 c, float f) {
vec3 mix3(vec3 c1, vec3 c2, vec3 c3, float x) { vec3 mix3(vec3 c1, vec3 c2, vec3 c3, float x) {
return istep(0.5, x) * mix(c1, c2, x * 2) return istep(0.5, x) * mix(c1, c2, x * 2)
+ step(0.5, x) * mix(c2, c3, x * 2 - 1) + step(0.5, x) * mix(c2, c3, x * 2 - 1);
;
} }
vec3 mix4(vec3 c1, vec3 c2, vec3 c3, vec3 c4, float x) { vec3 mix4(vec3 c1, vec3 c2, vec3 c3, vec3 c4, float x) {
@@ -98,8 +97,7 @@ vec3 mix5(vec3 c1, vec3 c2, vec3 c3, vec3 c4, vec3 c5, float x) {
return istep(0.25, x) * mix(c1, c2, x * 4) 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.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.5, x) * istep(0.75, x) * mix(c3, c4, x * 4 - 2)
+ step(0.75, x) * mix(c4, c5, x * 4 - 3) + 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) { vec3 mix6(vec3 c1, vec3 c2, vec3 c3, vec3 c4, vec3 c5, vec3 c6, float x) {
@@ -107,8 +105,7 @@ vec3 mix6(vec3 c1, vec3 c2, vec3 c3, vec3 c4, vec3 c5, vec3 c6, float x) {
+ step(0.2, x) * istep(0.4, x) * mix(c2, c3, x * 5 - 1) + 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.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.6, x) * istep(0.8, x) * mix(c4, c5, x * 5 - 3)
+ step(0.8, x) * mix(c5, c6, x * 5 - 4) + step(0.8, x) * mix(c5, c6, x * 5 - 4);
;
} }
float mean(vec3 v) float mean(vec3 v)
@@ -123,10 +120,10 @@ float mean(vec4 v)
// OTHER // OTHER
mat2 rot(float angle){ mat2 rot(float angle) {
return mat2( return mat2(
cos(angle*2.*PI),-sin(angle*2.*PI), cos(angle * 2. * PI), -sin(angle * 2. * PI),
sin(angle*2.*PI),cos(angle*2.*PI) sin(angle * 2. * PI), cos(angle * 2. * PI)
); );
} }
@@ -141,18 +138,18 @@ vec2 kal(vec2 uv, float n) {
float q = 3.0 / (2.0 * PI); float q = 3.0 / (2.0 * PI);
t = abs(mod(t + PI / (n), 2 * PI / n) - PI / (n)); t = abs(mod(t + PI / (n), 2 * PI / n) - PI / (n));
return length(uv) * vec2( return length(uv) * vec2(
cos(t), cos(t),
sin(t) sin(t)
); );
} }
vec2 kal2(vec2 uv, float n) { vec2 kal2(vec2 uv, float n) {
float t = atan(uv.y, uv.x) + PI * 0.5; float t = atan(uv.y, uv.x) + PI * 0.5;
float t2 = abs(mod(t + PI / n, 2 * PI / n) - PI / n); float t2 = abs(mod(t + PI / n, 2 * PI / n) - PI / n);
return length(uv) * vec2( return length(uv) * vec2(
cos(t2), cos(t2),
sin(t2) sin(t2)
); );
} }
// NOISE // NOISE
@@ -182,15 +179,15 @@ float v_index(vec2 uv) {
return floor(uv.x) + floor(uv.y) * 45; return floor(uv.x) + floor(uv.y) * 45;
} }
vec2 v_pos(float i) { vec2 v_pos(float i, int seed, float time) {
int iTimeId = int(iBeats); int iTimeId = int(time);
float iTimeV = iBeats - iTimeId; float iTimeV = time - iTimeId;
float x0 = rand(i + 823 + iTimeId); float x0 = rand(i + seed + iTimeId);
float y0 = rand(i + 328 + iTimeId); float y0 = rand(i + seed + 10 + iTimeId);
float x1 = rand(i + 823 + iTimeId + 1); float x1 = rand(i + seed + iTimeId + 1);
float y1 = rand(i + 328 + iTimeId + 1); float y1 = rand(i + seed + 10 + iTimeId + 1);
return vec2( return vec2(
mix(x0, x1, ease(ease(iTimeV))), mix(x0, x1, ease(ease(iTimeV))),
@@ -198,7 +195,7 @@ vec2 v_pos(float i) {
); );
} }
vec4 voronoi(vec2 uv, float dist) { vec4 voronoi(vec2 uv, float dist, int seed, float time) {
vec4 o = vec4(0, 0, 2, 0); vec4 o = vec4(0, 0, 2, 0);
vec4 t = vec4(0, 0, 2, 0); vec4 t = vec4(0, 0, 2, 0);
float d, i; float d, i;
@@ -207,7 +204,7 @@ vec4 voronoi(vec2 uv, float dist) {
for (int dy = -1; dy <= 1; dy++) { for (int dy = -1; dy <= 1; dy++) {
uv2 = vec2(floor(uv.x) + dx, floor(uv.y) + dy); uv2 = vec2(floor(uv.x) + dx, floor(uv.y) + dy);
i = v_index(uv2); i = v_index(uv2);
p = uv2 + v_pos(i) * dist; p = uv2 + v_pos(i, seed, time) * dist;
d = length(p - uv); d = length(p - uv);
if (d < o.z) { if (d < o.z) {
t = o; t = o;
@@ -260,9 +257,9 @@ float line(vec2 uv, vec2 p1, vec2 p2, float thick) {
if (abs(p.y) > abs(p.x)) { if (abs(p.y) > abs(p.x)) {
k = vec2( k = vec2(
uv.x - p.x * uv.y / p.y, uv.x - p.x * uv.y / p.y,
uv.y / p.y uv.y / p.y
); );
return step(k.x, thick * 0.5) return step(k.x, thick * 0.5)
* step(-k.x, thick * 0.5) * step(-k.x, thick * 0.5)
@@ -270,9 +267,9 @@ float line(vec2 uv, vec2 p1, vec2 p2, float thick) {
* (1 - step(k.y, 0)); * (1 - step(k.y, 0));
} else { } else {
k = vec2( k = vec2(
uv.x / p.x, uv.x / p.x,
uv.y - p.y * uv.x / p.x uv.y - p.y * uv.x / p.x
); );
return step(k.y, thick * 0.5) return step(k.y, thick * 0.5)
* step(-k.y, thick * 0.5) * step(-k.y, thick * 0.5)
@@ -281,7 +278,16 @@ float line(vec2 uv, vec2 p1, vec2 p2, float thick) {
} }
} }
const mat2x2 ISOMETRIC_MATRIX = {{0.5, 1}, {0.5, -1}}; const mat2x2 ISOMETRIC_MATRIX = {
{
0.5,
1
},
{
0.5,
-1
}
};
vec2 iso(vec2 p) { vec2 iso(vec2 p) {
return p * ISOMETRIC_MATRIX; return p * ISOMETRIC_MATRIX;
@@ -302,14 +308,14 @@ vec2 iso(vec3 uv) {
vec4 reframe(sampler2D tex, vec2 uv) vec4 reframe(sampler2D tex, vec2 uv)
{ {
uv = uv * vec2(iResolution.y / iResolution.x, 1) + .5; uv = uv * vec2(iResolution.y / iResolution.x, 1) + .5;
uv = saw(uv); uv = saw(uv);
return texture(tex, uv); return texture(tex, uv);
} }
vec4 reframe_b(sampler2D tex, vec2 uv) vec4 reframe_b(sampler2D tex, vec2 uv)
{ {
uv = uv * vec2(iResolution.y / iResolution.x, 1) + .5; uv = uv * vec2(iResolution.y / iResolution.x, 1) + .5;
return texture(tex, uv); return texture(tex, uv);
} }
+141 -113
View File
@@ -101,7 +101,139 @@ subroutine ( src_stage_sub ) vec4 src_3(vec2 vUV, int seed, vec3 b1, vec2 f1, ve
return vec4(f); return vec4(f);
} }
// SRC 4 : circuit // // SRC 4 : circuit
// subroutine ( src_stage_sub ) vec4 src_4(vec2 vUV, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3)
// {
// // start
// vec2 uv0 = vUV.st;
// float ratio = iResolution.x / iResolution.y;
// vec2 uv1 = (uv0 - .5) * vec2(ratio, 1);
// // controls
// float z = 10 + magic(f1, b1, 123) * 20;
// float h = magic(f2, b2, seed + 20) * 0.8 + 0.1;
// float v = magic_reverse(f3, b3, seed + 30) * 0.8 + 0.1;
// // logic
// uv1 *= z;
// uv1 += iBeats;
// float s0 = rand(floor(mod(uv1, 1000))) * 1000;
// float s1 = rand(floor(mod(uv1 + vec2(0, 1), 1000))) * 1000;
// float s2 = rand(floor(mod(uv1 - vec2(1, 0), 1000))) * 1000;
// bool up = rand(s1 + 1) < h;
// bool left = rand(s2 + 2) < v;
// bool down = rand(s0 + 1) < h;
// bool right = rand(s0 + 2) < v;
// bool up_down = up && down;
// bool left_right = left && right;
// uv1 = mod(uv1, 1.0) - 0.5;
// const float t = 0.1;
// float f = 0;
// int c = 0;
// if (up) {
// f += stripe(uv1.x, -t * 0.5, t * 0.5) * step(-t * 0.5, uv1.y);
// c += 1;
// }
// if (down) {
// f += stripe(uv1.x, -t * 0.5, t * 0.5) * istep(t * 0.5, uv1.y);
// c += 1;
// }
// if (left) {
// f += stripe(uv1.y, -t * 0.5, t * 0.5) * istep(t * 0.5, uv1.x);
// c += 1;
// }
// if (right) {
// f += stripe(uv1.y, -t * 0.5, t * 0.5) * step(-t * 0.5, uv1.x);
// c += 1;
// }
// if (c == 1) {
// f += istep(t, length(uv1));
// }
// f = min(f, 1);
// if ((up_down ^^ left_right) && c == 2) {
// if (up_down) {
// uv1.xy = uv1.yx;
// }
// if (rand(s0 + 3) < 0.5) {
// uv1.x = -uv1.x;
// }
// float k = rand(s0 + 4) * 60;
// f -= rect(uv1, vec2(0), vec2(t * 3, t));
// f = max(0, f);
// if (k < 10) { // resistor
// f += line(uv1, vec2(-t * 3.25, -t * 0.5), vec2(-t * 2.5, t * 2), t * 0.75);
// f += line(uv1, vec2(-t * 2.5, t * 2), vec2(-t * 1.5, -t * 2), t * 0.75);
// f += line(uv1, vec2(-t * 1.5, -t * 2), vec2(-t * 0.5, t * 2), t * 0.75);
// f += line(uv1, vec2(-t * 0.5, t * 2), vec2(t * 0.5, -t * 2), t * 0.75);
// f += line(uv1, vec2(t * 0.5, -t * 2), vec2(t * 1.5, t * 2), t * 0.75);
// f += line(uv1, vec2(t * 1.5, t * 2), vec2(t * 2.5, -t * 2), t * 0.75);
// f += line(uv1, vec2(t * 2.5, -t * 2), vec2(t * 3.25, t * 0.5), t * 0.75);
// } else if (k < 20) { // capacitor
// f += rect(uv1, vec2(-t * 2, 0), vec2(t, t * 0.5));
// f += rect(uv1, vec2(t * 2, 0), vec2(t, t * 0.5));
// f += rect(uv1, vec2(t, 0), vec2(t * 0.5, t * 3.5));
// f += rect(uv1, vec2(-t, 0), vec2(t * 0.5, t * 3.5));
// } else if (k < 30) { // diode
// f += line(uv1, vec2(-t * 2, t * 2.5), vec2(t * 2, 0), t);
// f += line(uv1, vec2(-t * 2, -t * 2.5), vec2(t * 2, 0), t);
// f += rect(uv1, vec2(t * 2.5, 0), vec2(t * 0.5, t * 3));
// f += rect(uv1, vec2(-t * 2.5, 0), vec2(t * 0.5, t * 3));
// } else if (k < 40) { // lamp
// f += istep(t * 3.5, length(uv1));
// f -= istep(t * 2.5, length(uv1));
// f += line(uv1, vec2(-t * 2), vec2(t * 2), t);
// f += line(uv1, vec2(-t * 2, t * 2), vec2(t * 2, -t * 2), t);
// } else if (k < 50) { // inductor
// f += istep(t * 2, length(uv1 - vec2(t * 2.5, 0)));
// f += istep(t * 2, length(uv1 - vec2(0, 0)));
// f += istep(t * 2, length(uv1 - vec2(-t * 2.5, 0)));
// f -= 2 * istep(t, length(uv1 - vec2(t * 2.5, 0)));
// f -= 2 * istep(t, length(uv1 - vec2(0, 0)));
// f -= 2 * istep(t, length(uv1 - vec2(-t * 2.5, 0)));
// f *= step(-t * 0.5, uv1.y);
// } else if (k < 60) { // switch
// f += istep(t, length(uv1 - vec2(t * 2.5, 0)));
// f += istep(t, length(uv1 + vec2(t * 2.5, 0)));
// f += line(uv1, vec2(t * 2, 0), vec2(-t * 2.5, t * (k < 55 ? 3 : 1)), t);
// }
// } else if (c == 3) {
// if (left_right) {
// uv1.xy = uv1.yx;
// if (up) {
// uv1.x = -uv1.x;
// }
// } else if (right) {
// uv1.x = -uv1.x;
// }
// float k = rand(s0 + 4) * 20;
// if (k < 10) {
// f -= rect(uv1, vec2(0), vec2(t * 3));
// f = max(0, f);
// f += rect(uv1, vec2(-t * 3, 0), vec2(t * 0.5, t * 3));
// f += line(uv1, vec2(t * 0.25, t * 3.25), vec2(-t * 3, t), t);
// f += line(uv1, vec2(t * 0.25, -t * 3.25), vec2(-t * 3, -t), t);
// }
// }
// return vec4(f);
// }
// SRC 4 : bacteria
subroutine ( src_stage_sub ) vec4 src_4(vec2 vUV, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3) subroutine ( src_stage_sub ) vec4 src_4(vec2 vUV, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3)
{ {
// start // start
@@ -112,123 +244,19 @@ subroutine ( src_stage_sub ) vec4 src_4(vec2 vUV, int seed, vec3 b1, vec2 f1, ve
// controls // controls
float z = 10 + magic(f1, b1, 123) * 20; float zoom = 2 + magic(f1, b1, seed + 10) * 20;
float h = magic(f2, b2, seed + 20) * 0.8 + 0.1; float details = 5 * magic(f2, b2, seed + 20);
float v = magic_reverse(f3, b3, seed + 30) * 0.8 + 0.1; float delta = magic(f3, b3, seed + 30);
// logic // logic
uv1 *= z; uv1 *= zoom;
uv1 += iBeats;
float s0 = rand(floor(mod(uv1, 1000))) * 1000; vec4 data = voronoi(uv1, 1, seed + 40, iBeats * 0.25);
float s1 = rand(floor(mod(uv1 + vec2(0, 1), 1000))) * 1000;
float s2 = rand(floor(mod(uv1 - vec2(1, 0), 1000))) * 1000;
bool up = rand(s1 + 1) < h; float f = ease(data.x) + ease(data.y);
bool left = rand(s2 + 2) < v;
bool down = rand(s0 + 1) < h;
bool right = rand(s0 + 2) < v;
bool up_down = up && down;
bool left_right = left && right;
uv1 = mod(uv1, 1.0) - 0.5; f = saw(f * (1 + data.x * details) - delta * 2.0);
const float t = 0.1;
float f = 0;
int c = 0;
if (up) {
f += stripe(uv1.x, -t * 0.5, t * 0.5) * step(-t * 0.5, uv1.y);
c += 1;
}
if (down) {
f += stripe(uv1.x, -t * 0.5, t * 0.5) * istep(t * 0.5, uv1.y);
c += 1;
}
if (left) {
f += stripe(uv1.y, -t * 0.5, t * 0.5) * istep(t * 0.5, uv1.x);
c += 1;
}
if (right) {
f += stripe(uv1.y, -t * 0.5, t * 0.5) * step(-t * 0.5, uv1.x);
c += 1;
}
if (c == 1) {
f += istep(t, length(uv1));
}
f = min(f, 1);
if ((up_down ^^ left_right) && c == 2) {
if (up_down) {
uv1.xy = uv1.yx;
}
if (rand(s0 + 3) < 0.5) {
uv1.x = -uv1.x;
}
float k = rand(s0 + 4) * 60;
f -= rect(uv1, vec2(0), vec2(t * 3, t));
f = max(0, f);
if (k < 10) { // resistor
f += line(uv1, vec2(-t * 3.25, -t * 0.5), vec2(-t * 2.5, t * 2), t * 0.75);
f += line(uv1, vec2(-t * 2.5, t * 2), vec2(-t * 1.5, -t * 2), t * 0.75);
f += line(uv1, vec2(-t * 1.5, -t * 2), vec2(-t * 0.5, t * 2), t * 0.75);
f += line(uv1, vec2(-t * 0.5, t * 2), vec2(t * 0.5, -t * 2), t * 0.75);
f += line(uv1, vec2(t * 0.5, -t * 2), vec2(t * 1.5, t * 2), t * 0.75);
f += line(uv1, vec2(t * 1.5, t * 2), vec2(t * 2.5, -t * 2), t * 0.75);
f += line(uv1, vec2(t * 2.5, -t * 2), vec2(t * 3.25, t * 0.5), t * 0.75);
} else if (k < 20) { // capacitor
f += rect(uv1, vec2(-t * 2, 0), vec2(t, t * 0.5));
f += rect(uv1, vec2(t * 2, 0), vec2(t, t * 0.5));
f += rect(uv1, vec2(t, 0), vec2(t * 0.5, t * 3.5));
f += rect(uv1, vec2(-t, 0), vec2(t * 0.5, t * 3.5));
} else if (k < 30) { // diode
f += line(uv1, vec2(-t * 2, t * 2.5), vec2(t * 2, 0), t);
f += line(uv1, vec2(-t * 2, -t * 2.5), vec2(t * 2, 0), t);
f += rect(uv1, vec2(t * 2.5, 0), vec2(t * 0.5, t * 3));
f += rect(uv1, vec2(-t * 2.5, 0), vec2(t * 0.5, t * 3));
} else if (k < 40) { // lamp
f += istep(t * 3.5, length(uv1));
f -= istep(t * 2.5, length(uv1));
f += line(uv1, vec2(-t * 2), vec2(t * 2), t);
f += line(uv1, vec2(-t * 2, t * 2), vec2(t * 2, -t * 2), t);
} else if (k < 50) { // inductor
f += istep(t * 2, length(uv1 - vec2(t * 2.5, 0)));
f += istep(t * 2, length(uv1 - vec2(0, 0)));
f += istep(t * 2, length(uv1 - vec2(-t * 2.5, 0)));
f -= 2 * istep(t, length(uv1 - vec2(t * 2.5, 0)));
f -= 2 * istep(t, length(uv1 - vec2(0, 0)));
f -= 2 * istep(t, length(uv1 - vec2(-t * 2.5, 0)));
f *= step(-t * 0.5, uv1.y);
} else if (k < 60) { // switch
f += istep(t, length(uv1 - vec2(t * 2.5, 0)));
f += istep(t, length(uv1 + vec2(t * 2.5, 0)));
f += line(uv1, vec2(t * 2, 0), vec2(-t * 2.5, t * (k < 55 ? 3 : 1)), t);
}
} else if (c == 3) {
if (left_right) {
uv1.xy = uv1.yx;
if (up) {
uv1.x = -uv1.x;
}
} else if (right) {
uv1.x = -uv1.x;
}
float k = rand(s0 + 4) * 20;
if (k < 10) {
f -= rect(uv1, vec2(0), vec2(t * 3));
f = max(0, f);
f += rect(uv1, vec2(-t * 3, 0), vec2(t * 0.5, t * 3));
f += line(uv1, vec2(t * 0.25, t * 3.25), vec2(-t * 3, t), t);
f += line(uv1, vec2(t * 0.25, -t * 3.25), vec2(-t * 3, -t), t);
}
}
return vec4(f); return vec4(f);
} }
@@ -254,7 +282,7 @@ subroutine ( src_stage_sub ) vec4 src_5(vec2 vUV, int seed, vec3 b1, vec2 f1, ve
vec2 uv2 = uv1; vec2 uv2 = uv1;
uv2 *= zoom * 20 + 3; uv2 *= zoom * 20 + 3;
uv2.x += iBeats; uv2.x += iBeats;
vec4 data = voronoi(uv2, voronoi_distort); vec4 data = voronoi(uv2, voronoi_distort, seed + 50, iBeats);
float f = data.x / (data.x + data.y); float f = data.x / (data.x + data.y);
f = sin(f * PI * (details * 20)) * 0.5 + 1; f = sin(f * PI * (details * 20)) * 0.5 + 1;
int nf = int(noise_factor * 6); int nf = int(noise_factor * 6);
Binary file not shown.