monitor param
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
TARGET ?= forge
|
TARGET ?= forge
|
||||||
INSTALL_DIR ?= $(HOME)/.local/bin
|
INSTALL_DIR ?= $(HOME)/.local/bin
|
||||||
TEST_ARGS ?= --hot-reload --frag=./shaders --frag-config=./config/shaders.cfg --demo -is=480
|
TEST_ARGS ?= --hot-reload --frag=./shaders --frag-config=./config/shaders.cfg --demo --monitor --internal-size=480
|
||||||
SHELL := /bin/bash
|
SHELL := /bin/bash
|
||||||
|
|
||||||
.PHONY: build
|
.PHONY: build
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ make -f Makefile.dev release-arch
|
|||||||
- [x] subroutines config
|
- [x] subroutines config
|
||||||
- [x] demo mode
|
- [x] demo mode
|
||||||
- [x] random seed injected into shaders
|
- [x] random seed injected into shaders
|
||||||
- [ ] internal texture size for speed
|
- [x] internal texture size for speed
|
||||||
- [ ] pass state as uniform
|
- [ ] pass state as uniform
|
||||||
- [ ] debug shader (and in monitor)
|
- [ ] debug shader (and in monitor)
|
||||||
- [ ] Clean code and fix things
|
- [ ] Clean code and fix things
|
||||||
|
|||||||
+42
-11
@@ -9,16 +9,47 @@ float s(vec2 uv, float x0, float y0) {
|
|||||||
step(-y0 - 1, -uv.y);
|
step(-y0 - 1, -uv.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const int texts[8][5] = {
|
||||||
|
{0x49, 0x4E, 0x20, 0x41, 0x00}, // IN A
|
||||||
|
{0x49, 0x4E, 0x20, 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
|
||||||
|
};
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
vec2 uv = vUV * 3;
|
vec2 uv0 = vUV.st;
|
||||||
fragColor = vec4(0);
|
float ratio = iResolution.x / iResolution.y;
|
||||||
fragColor += s(uv,0,2) * texture(tex1, uv);
|
vec2 uv1 = (uv0 - .5) * vec2(ratio, 1);
|
||||||
fragColor += s(uv,1,2) * texture(tex2, uv);
|
|
||||||
fragColor += s(uv,2,2) * texture(tex3, uv);
|
vec2 uv2 = uv0 * 3;
|
||||||
fragColor += s(uv,0,1) * texture(tex4, uv);
|
vec2 uv3 = uv1 * 30;
|
||||||
fragColor += s(uv,1,1) * texture(tex5, uv);
|
|
||||||
fragColor += s(uv,2,1) * texture(tex6, uv);
|
vec4 c = vec4(0);
|
||||||
fragColor += s(uv,0,0) * texture(tex7, uv);
|
|
||||||
fragColor += s(uv,1,0) * texture(tex8, uv);
|
c += s(uv2,0,2) * texture(tex1, uv2);
|
||||||
fragColor += s(uv,2,0) * texture(tex0, uv);
|
c += s(uv2,1,2) * texture(tex2, uv2);
|
||||||
|
c += s(uv2,2,2) * texture(tex3, uv2);
|
||||||
|
c += s(uv2,0,1) * texture(tex7, uv2);
|
||||||
|
c += s(uv2,1,1) * texture(tex8, uv2);
|
||||||
|
c += s(uv2,2,1) * texture(tex0, uv2);
|
||||||
|
c += s(uv2,0,0) * texture(tex4, uv2);
|
||||||
|
c += s(uv2,1,0) * texture(tex5, uv2);
|
||||||
|
c += s(uv2,2,0) * texture(tex6, uv2);
|
||||||
|
|
||||||
|
float t = 0;
|
||||||
|
|
||||||
|
t += write_5(uv3, vec2(-26.5,13.5), texts[0]);
|
||||||
|
t += write_5(uv3, vec2(-26.5,-6.5), texts[1]);
|
||||||
|
t += write_5(uv3, vec2(-8.5,13.5), texts[2]);
|
||||||
|
t += write_5(uv3, vec2(-8.5,-6.5), texts[3]);
|
||||||
|
t += write_5(uv3, vec2(9.5,13.5), texts[4]);
|
||||||
|
t += write_5(uv3, vec2(9.5,-6.5), texts[5]);
|
||||||
|
t += write_5(uv3, vec2(-8.5,3.5), texts[6]);
|
||||||
|
t += write_5(uv3, vec2(9.5,3.5), texts[7]);
|
||||||
|
|
||||||
|
fragColor = mix(c, 1 - c, t);
|
||||||
}
|
}
|
||||||
@@ -20,7 +20,9 @@ static void print_help(int status_code) {
|
|||||||
"[-s=SCREEN] "
|
"[-s=SCREEN] "
|
||||||
"[-f=DIR_PATH] "
|
"[-f=DIR_PATH] "
|
||||||
"[-fc=CFG_PATH] "
|
"[-fc=CFG_PATH] "
|
||||||
|
"[-is=SIZE] "
|
||||||
"[-t=TEMPO] "
|
"[-t=TEMPO] "
|
||||||
|
"[--monitor] "
|
||||||
"[--demo] "
|
"[--demo] "
|
||||||
"\n\n"
|
"\n\n"
|
||||||
"Fusion Of Real-time Generative Effects.\n\n"
|
"Fusion Of Real-time Generative Effects.\n\n"
|
||||||
@@ -33,6 +35,7 @@ static void print_help(int status_code) {
|
|||||||
" -fc, --frag-config fragment shaders config file (default: TODO)\n"
|
" -fc, --frag-config fragment shaders config file (default: TODO)\n"
|
||||||
" -is, --internal-size internal texture height (default: 720)\n"
|
" -is, --internal-size internal texture height (default: 720)\n"
|
||||||
" -t, --tempo base tempo (default: 60)\n"
|
" -t, --tempo base tempo (default: 60)\n"
|
||||||
|
" -m, --monitor output monitor\n"
|
||||||
" --demo demonstration mode\n");
|
" --demo demonstration mode\n");
|
||||||
exit(status_code);
|
exit(status_code);
|
||||||
}
|
}
|
||||||
@@ -77,6 +80,7 @@ Parameters args_parse(int argc, char **argv) {
|
|||||||
params.frag_config_path = 0;
|
params.frag_config_path = 0;
|
||||||
params.internal_size = 720;
|
params.internal_size = 720;
|
||||||
params.base_tempo = 60.0f;
|
params.base_tempo = 60.0f;
|
||||||
|
params.monitor = false;
|
||||||
params.demo = false;
|
params.demo = false;
|
||||||
|
|
||||||
for (i = 1; i < argc; i++) {
|
for (i = 1; i < argc; i++) {
|
||||||
@@ -99,6 +103,8 @@ Parameters args_parse(int argc, char **argv) {
|
|||||||
params.base_tempo = (float)parse_uint(arg, value);
|
params.base_tempo = (float)parse_uint(arg, value);
|
||||||
} else if (is_arg(arg, "-is") || is_arg(arg, "--internal-size")) {
|
} else if (is_arg(arg, "-is") || is_arg(arg, "--internal-size")) {
|
||||||
params.internal_size = (float)parse_uint(arg, value);
|
params.internal_size = (float)parse_uint(arg, value);
|
||||||
|
} else if (is_arg(arg, "--monitor")) {
|
||||||
|
params.monitor = true;
|
||||||
} else if (is_arg(arg, "--demo")) {
|
} else if (is_arg(arg, "--demo")) {
|
||||||
params.demo = true;
|
params.demo = true;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ static void init_context(ShaderProgram program, Context *context,
|
|||||||
|
|
||||||
context->tempo = params.base_tempo;
|
context->tempo = params.base_tempo;
|
||||||
context->demo = params.demo;
|
context->demo = params.demo;
|
||||||
|
context->monitor = params.monitor;
|
||||||
|
|
||||||
size = program.frag_count * program.sub_type_count;
|
size = program.frag_count * program.sub_type_count;
|
||||||
context->sub_state = malloc(size * sizeof(unsigned int));
|
context->sub_state = malloc(size * sizeof(unsigned int));
|
||||||
|
|||||||
+4
-1
@@ -366,5 +366,8 @@ void shaders_apply(ShaderProgram program, Context context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
use_program(program, program.frag_monitor_index, true, context);
|
use_program(program,
|
||||||
|
context.monitor ? program.frag_monitor_index
|
||||||
|
: program.frag_output_index,
|
||||||
|
true, context);
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-3
@@ -10,13 +10,14 @@
|
|||||||
#define TYPES_H
|
#define TYPES_H
|
||||||
|
|
||||||
typedef struct Parameters {
|
typedef struct Parameters {
|
||||||
|
bool hot_reload;
|
||||||
unsigned char screen;
|
unsigned char screen;
|
||||||
char *frag_path;
|
char *frag_path;
|
||||||
char *frag_config_path;
|
char *frag_config_path;
|
||||||
bool hot_reload;
|
|
||||||
float base_tempo;
|
|
||||||
bool demo;
|
|
||||||
unsigned int internal_size;
|
unsigned int internal_size;
|
||||||
|
float base_tempo;
|
||||||
|
bool monitor;
|
||||||
|
bool demo;
|
||||||
} Parameters;
|
} Parameters;
|
||||||
|
|
||||||
typedef struct Vertex {
|
typedef struct Vertex {
|
||||||
@@ -81,6 +82,7 @@ typedef struct Context {
|
|||||||
unsigned int *sub_state;
|
unsigned int *sub_state;
|
||||||
bool demo;
|
bool demo;
|
||||||
unsigned int *seeds;
|
unsigned int *seeds;
|
||||||
|
bool monitor;
|
||||||
} Context;
|
} Context;
|
||||||
|
|
||||||
typedef struct Timer {
|
typedef struct Timer {
|
||||||
|
|||||||
Reference in New Issue
Block a user