monitor param

This commit is contained in:
2025-09-20 19:30:47 +02:00
parent e4c9125c18
commit ce1d0dba60
7 changed files with 60 additions and 17 deletions
+6
View File
@@ -20,7 +20,9 @@ static void print_help(int status_code) {
"[-s=SCREEN] "
"[-f=DIR_PATH] "
"[-fc=CFG_PATH] "
"[-is=SIZE] "
"[-t=TEMPO] "
"[--monitor] "
"[--demo] "
"\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"
" -is, --internal-size internal texture height (default: 720)\n"
" -t, --tempo base tempo (default: 60)\n"
" -m, --monitor output monitor\n"
" --demo demonstration mode\n");
exit(status_code);
}
@@ -77,6 +80,7 @@ Parameters args_parse(int argc, char **argv) {
params.frag_config_path = 0;
params.internal_size = 720;
params.base_tempo = 60.0f;
params.monitor = false;
params.demo = false;
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);
} else if (is_arg(arg, "-is") || is_arg(arg, "--internal-size")) {
params.internal_size = (float)parse_uint(arg, value);
} else if (is_arg(arg, "--monitor")) {
params.monitor = true;
} else if (is_arg(arg, "--demo")) {
params.demo = true;
} else {
+1
View File
@@ -50,6 +50,7 @@ static void init_context(ShaderProgram program, Context *context,
context->tempo = params.base_tempo;
context->demo = params.demo;
context->monitor = params.monitor;
size = program.frag_count * program.sub_type_count;
context->sub_state = malloc(size * sizeof(unsigned int));
+4 -1
View File
@@ -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
View File
@@ -10,13 +10,14 @@
#define TYPES_H
typedef struct Parameters {
bool hot_reload;
unsigned char screen;
char *frag_path;
char *frag_config_path;
bool hot_reload;
float base_tempo;
bool demo;
unsigned int internal_size;
float base_tempo;
bool monitor;
bool demo;
} Parameters;
typedef struct Vertex {
@@ -81,6 +82,7 @@ typedef struct Context {
unsigned int *sub_state;
bool demo;
unsigned int *seeds;
bool monitor;
} Context;
typedef struct Timer {