feat: forge_project.cfg
This commit is contained in:
@@ -0,0 +1,257 @@
|
||||
###########
|
||||
## FORGE ##
|
||||
###########
|
||||
# Your reading a FORGE configuration file, don't panic
|
||||
# Everything here is designed to link elements between them
|
||||
# (shaders, video devices, textures, midi inputs, etc.)
|
||||
# Every number based constant will be "one-based" (1,2,3,etc.)
|
||||
# To read more, go to
|
||||
# https://github.com/klemek/forge-steel
|
||||
|
||||
|
||||
# ================
|
||||
# FRAGMENT SHADERS
|
||||
# ================
|
||||
|
||||
|
||||
# === UNIFORMS ===
|
||||
# GLSL uniform names or prefixes
|
||||
# Prefixed uniforms are "iVariableX" with a number
|
||||
|
||||
# --- uniform float ---
|
||||
|
||||
# Elapsed time
|
||||
UNIFORM_TIME=iTime
|
||||
# Current tempo
|
||||
UNIFORM_TEMPO=iTempo
|
||||
|
||||
# --- uniform int ---
|
||||
|
||||
# Output frame per second
|
||||
UNIFORM_FPS=iFPS
|
||||
# Input X frame per second
|
||||
UNIFORM_IN_FPS_PREFIX=iInputFPS
|
||||
# 0/1 if demo
|
||||
UNIFORM_DEMO=iDemo
|
||||
# Current page
|
||||
UNIFORM_PAGE=iPage
|
||||
# Current selected shader
|
||||
UNIFORM_SELECTED=iSelected
|
||||
# Seed for shader X
|
||||
UNIFORM_SEED_PREFIX=iSeed
|
||||
# State for shader X
|
||||
UNIFORM_STATE_PREFIX=iState
|
||||
# Midi group X active layer number
|
||||
UNIFORM_ACTIVE_PREFIX=iActive
|
||||
# Input X format raw integer value
|
||||
UNIFORM_IN_FORMAT_PREFIX=iInputFormat
|
||||
|
||||
# --- uniform vec2 ---
|
||||
|
||||
# Output resolution
|
||||
UNIFORM_RESOLUTION=iResolution
|
||||
# Internal textures resolution
|
||||
UNIFORM_TEX_RESOLUTION=iTexResolution
|
||||
# Input X resolution
|
||||
UNIFORM_IN_RESOLUTION_PREFIX=iInputResolution
|
||||
|
||||
# --- uniform vec3 ---
|
||||
|
||||
# Midi group X layer Y (beware of group size)
|
||||
# Injected as "iMidiX_Y[Z]"
|
||||
UNIFORM_MIDI_PREFIX=iMidi
|
||||
|
||||
# --- uniform sampler2D ---
|
||||
|
||||
# Internal texture X
|
||||
UNIFORM_TEX_PREFIX=iTex
|
||||
|
||||
# === SUBROUTINES ===
|
||||
# GLSL subroutines prefixes
|
||||
# You can then use them as:
|
||||
# subroutine(<definition>) <type> <prefix><number>(<args>) {}
|
||||
# (see: https://wikis.khronos.org/opengl/Shader_Subroutine)
|
||||
# Numbers go from 1 to SELECT_PAGE_COUNT * SELECT_ITEM_COUNT
|
||||
# Each fragment shader is injected its current state subroutine
|
||||
|
||||
# Total subroutine variants
|
||||
SUB_TYPE_COUNT=2
|
||||
# Each subroutine variant prefix
|
||||
SUB_1_PREFIX=src_
|
||||
SUB_2_PREFIX=fx_
|
||||
|
||||
|
||||
# ===========
|
||||
# TEXTURE I/O
|
||||
# ===========
|
||||
|
||||
|
||||
# Total number of internal textures
|
||||
TEX_COUNT=10
|
||||
|
||||
# === VIDEO DEVICES
|
||||
# Video devices will be read from CLI arguments
|
||||
# and used in the same order inside FORGE
|
||||
|
||||
# Number of video devices
|
||||
IN_COUNT=2
|
||||
# To which texture will be bound video device X
|
||||
IN_1_OUT=1
|
||||
IN_2_OUT=2
|
||||
|
||||
# === FRAGMENT SHADERS
|
||||
# Fragment shaders will be read from the CLI directory as "fragX.glsl"
|
||||
# Special shader "frag0.glsl" will be prepend to each one
|
||||
|
||||
# Total number of fragment shaders (excluding frag0.glsl)
|
||||
FRAG_COUNT=10
|
||||
|
||||
# To which texture will the shader fragX.glsl will render to
|
||||
FRAG_1_OUT=3
|
||||
FRAG_2_OUT=4
|
||||
FRAG_3_OUT=5
|
||||
FRAG_4_OUT=6
|
||||
FRAG_5_OUT=7
|
||||
FRAG_6_OUT=8
|
||||
FRAG_7_OUT=9
|
||||
FRAG_8_OUT=0
|
||||
# Which fragment shader renders to output window
|
||||
FRAG_OUTPUT=9
|
||||
# Which fragment shader renders to monitor window
|
||||
FRAG_MONITOR=10
|
||||
|
||||
|
||||
# ========
|
||||
# MIDI I/O
|
||||
# ========
|
||||
|
||||
|
||||
# The recognized ALSA name of the midi device
|
||||
MIDI_HW=hw:CARD=nanoKONTROL2
|
||||
|
||||
# === TYPES OF EVENTS
|
||||
# FORGE needs to differentiate between fader and buttons
|
||||
# In the next configurations, when an event is not configured,
|
||||
# it will be skipped
|
||||
|
||||
# Total number of faders
|
||||
FADER_COUNT=16
|
||||
# Midi codes of faders
|
||||
FADER_1=0
|
||||
FADER_2=1
|
||||
FADER_3=2
|
||||
FADER_4=3
|
||||
FADER_5=4
|
||||
FADER_6=5
|
||||
FADER_7=6
|
||||
FADER_8=7
|
||||
FADER_9=16
|
||||
FADER_10=17
|
||||
FADER_11=18
|
||||
FADER_12=19
|
||||
FADER_13=20
|
||||
FADER_14=21
|
||||
FADER_15=22
|
||||
FADER_16=23
|
||||
# Midi code for tap tempo
|
||||
TAP_TEMPO=46
|
||||
|
||||
# === FRAGMENT SUBROUTINE SELECT
|
||||
# You can manipulate which subroutine is sent to which fragment shader
|
||||
|
||||
# Midi codes to select fragment X
|
||||
SELECT_FRAG_3=32
|
||||
SELECT_FRAG_4=64
|
||||
SELECT_FRAG_5=36
|
||||
SELECT_FRAG_6=68
|
||||
SELECT_FRAG_8=52
|
||||
# Total number of pages (can be 1)
|
||||
SELECT_PAGE_COUNT=3
|
||||
# Midi codes to select page X
|
||||
SELECT_PAGE_1=60
|
||||
SELECT_PAGE_2=61
|
||||
SELECT_PAGE_3=62
|
||||
# Total number of items per page
|
||||
SELECT_ITEM_COUNT=5
|
||||
# Midi codes to select item Y on page X
|
||||
SELECT_ITEM_1=43
|
||||
SELECT_ITEM_2=44
|
||||
SELECT_ITEM_3=42
|
||||
SELECT_ITEM_4=41
|
||||
SELECT_ITEM_5=45
|
||||
|
||||
# === MIDI INPUT STATES
|
||||
# Midi inputs will control FORGE's state as follows
|
||||
# X groups of Y layers sized Z
|
||||
# You can manipulate only 1 layer at a time
|
||||
# Every layer of every groups will be send as uniforms
|
||||
# Each active layer will be sent back to the device
|
||||
# with the same codes for nice display
|
||||
|
||||
# Total number of groups
|
||||
MIDI_COUNT=3
|
||||
|
||||
# Total number of layers of group 1
|
||||
MIDI_1_ACTIVE_COUNT=2
|
||||
# Midi codes to change layer of group 1
|
||||
MIDI_1_ACTIVE_1=32
|
||||
MIDI_1_ACTIVE_2=64
|
||||
|
||||
# Size of group 1
|
||||
MIDI_1_COUNT=6
|
||||
# Every code of active layer manipulation of group 1
|
||||
MIDI_1_1_X=33
|
||||
MIDI_1_1_Y=49
|
||||
MIDI_1_1_Z=65
|
||||
MIDI_1_2_X=1
|
||||
MIDI_1_2_Y=17
|
||||
MIDI_1_2_Z=
|
||||
MIDI_1_3_X=34
|
||||
MIDI_1_3_Y=50
|
||||
MIDI_1_3_Z=66
|
||||
MIDI_1_4_X=2
|
||||
MIDI_1_4_Y=18
|
||||
MIDI_1_4_Z=
|
||||
MIDI_1_5_X=35
|
||||
MIDI_1_5_Y=51
|
||||
MIDI_1_5_Z=67
|
||||
MIDI_1_6_X=3
|
||||
MIDI_1_6_Y=19
|
||||
MIDI_1_6_Z=
|
||||
|
||||
# Same for group 2
|
||||
MIDI_2_ACTIVE_COUNT=3
|
||||
MIDI_2_ACTIVE_1=36
|
||||
MIDI_2_ACTIVE_2=68
|
||||
MIDI_2_ACTIVE_3=52
|
||||
MIDI_2_COUNT=7
|
||||
MIDI_2_1_X=37
|
||||
MIDI_2_1_Y=53
|
||||
MIDI_2_1_Z=69
|
||||
MIDI_2_2_X=5
|
||||
MIDI_2_2_Y=21
|
||||
MIDI_2_2_Z=
|
||||
MIDI_2_3_X=38
|
||||
MIDI_2_3_Y=54
|
||||
MIDI_2_3_Z=70
|
||||
MIDI_2_4_X=6
|
||||
MIDI_2_4_Y=22
|
||||
MIDI_2_4_Z=
|
||||
MIDI_2_5_X=39
|
||||
MIDI_2_5_Y=55
|
||||
MIDI_2_5_Z=71
|
||||
MIDI_2_6_X=7
|
||||
MIDI_2_6_Y=23
|
||||
MIDI_2_6_Z=
|
||||
MIDI_2_7_X=4
|
||||
MIDI_2_7_Y=20
|
||||
MIDI_2_7_Z=59
|
||||
|
||||
# Same for group 3
|
||||
MIDI_3_COUNT=2
|
||||
MIDI_3_1_X=48
|
||||
MIDI_3_1_Y=58
|
||||
MIDI_3_1_Z=
|
||||
MIDI_3_2_X=0
|
||||
MIDI_3_2_Y=16
|
||||
MIDI_3_2_Z=
|
||||
+1822
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,15 @@
|
||||
// VIDEO 1
|
||||
// -----------
|
||||
// IN: 1 (RAW IN A)
|
||||
// OUT: 3 (IN A)
|
||||
|
||||
in vec2 vUV;
|
||||
out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
if (iInputFormat1 == YUYV_FOURCC) {
|
||||
fragColor = yuyvTex(iTex1, vUV, int(iInputResolution1.x));
|
||||
} else {
|
||||
fragColor = texture(iTex0, vUV);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
// MONITOR
|
||||
// ---
|
||||
|
||||
in vec2 vUV;
|
||||
out vec4 fragColor;
|
||||
|
||||
uniform int iInputFPS1;
|
||||
uniform int iInputFPS2;
|
||||
|
||||
float s(vec2 uv, float x0, float y0) {
|
||||
return step(x0, uv.x) * step(-x0 - 1, -uv.x) * step(y0, uv.y) *
|
||||
step(-y0 - 1, -uv.y);
|
||||
}
|
||||
|
||||
const int texts[10][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
|
||||
{0x46, 0x50, 0x53, 0x00, 0x00}, // FPS
|
||||
{0x4F, 0x46, 0x46, 0x00, 0x00}, // OFF
|
||||
};
|
||||
|
||||
void main() {
|
||||
vec2 uv0 = vUV.st;
|
||||
float ratio = iResolution.x / iResolution.y;
|
||||
vec2 uv1 = (uv0 - .5) * vec2(ratio, 1);
|
||||
|
||||
vec2 uv2 = uv0 * 3;
|
||||
vec2 uv3 = uv1 * 60;
|
||||
|
||||
vec4 c = vec4(0);
|
||||
|
||||
c += s(uv2,1,2) * texture(iTex5, uv2);
|
||||
c += s(uv2,2,2) * texture(iTex7, uv2);
|
||||
|
||||
c += s(uv2,1,1) * texture(iTex6, uv2);
|
||||
c += s(uv2,2,1) * texture(iTex8, uv2);
|
||||
|
||||
c += s(uv2,0,0) * src_15(mod(uv2, 1), 0, vec3(0), vec2(0), vec3(0), vec2(0), vec3(0), vec2(0));
|
||||
c += s(uv2,1,0) * texture(iTex9, uv2);
|
||||
c += s(uv2,2,0) * texture(iTex0, uv2);
|
||||
|
||||
float f = 0;
|
||||
float t = 0;
|
||||
|
||||
f += rect(uv3, vec2(-51, 28.5), vec2(2.1, 0.7));
|
||||
t += write_5(uv3, vec2(-53,28), texts[0]);
|
||||
|
||||
if (iInputResolution1.x > 0) {
|
||||
c += s(uv2,0,2) * texture(iTex3, uv2);
|
||||
f += rect(uv3, vec2(-50.4, 26.5), vec2(2.8, 0.7));
|
||||
t += write_int(uv3, vec2(-53,26), iInputFPS1, 2);
|
||||
t += write_5(uv3, vec2(-50.5,26), texts[8]);
|
||||
} else {
|
||||
f += rect(uv3, vec2(-51.5, 26.5), vec2(1.6, 0.7));
|
||||
t += write_5(uv3, vec2(-53,26), texts[9]);
|
||||
}
|
||||
|
||||
f += rect(uv3, vec2(-51, 8.5), vec2(2.1, 0.7));
|
||||
t += write_5(uv3, vec2(-53,8), texts[1]);
|
||||
|
||||
if (iInputResolution2.x > 0) {
|
||||
c += s(uv2,0,1) * texture(iTex4, uv2);
|
||||
f += rect(uv3, vec2(-50.4, 6.5), vec2(2.8, 0.7));
|
||||
t += write_int(uv3, vec2(-53,6), iInputFPS2, 2);
|
||||
t += write_5(uv3, vec2(-50.5,6), texts[8]);
|
||||
} else {
|
||||
f += rect(uv3, vec2(-51.5, 6.5), vec2(1.6, 0.7));
|
||||
t += write_5(uv3, vec2(-53,6), 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, 8.5), vec2(2.6, 0.7));
|
||||
t += write_5(uv3, vec2(-17,8), 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, 8.5), vec2(2.1, 0.7));
|
||||
t += write_5(uv3, vec2(19,8), texts[5]);
|
||||
f += rect(uv3, vec2(-15.5, -11.5), vec2(1.6, 0.7));
|
||||
t += write_5(uv3, vec2(-17,-12), texts[6]);
|
||||
f += rect(uv3, vec2(20.5, -11.5), vec2(1.6, 0.7));
|
||||
t += write_5(uv3, vec2(19,-12), texts[7]);
|
||||
|
||||
fragColor = mix(c, vec4(f - t), f);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// VIDEO 2
|
||||
// -----------
|
||||
// IN: 2 (RAW IN B)
|
||||
// OUT: 4 (IN B)
|
||||
|
||||
in vec2 vUV;
|
||||
out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
if (iInputFormat2 == YUYV_FOURCC) {
|
||||
fragColor = yuyvTex(iTex2, vUV, int(iInputResolution2.x));
|
||||
} else {
|
||||
fragColor = texture(iTex0, vUV);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// SRC A
|
||||
// -----------
|
||||
// OUT: 5 (FX A)
|
||||
|
||||
in vec2 vUV;
|
||||
out vec4 fragColor;
|
||||
|
||||
uniform vec3 iMidi1_1[6];
|
||||
|
||||
void main() {
|
||||
fragColor = src_stage(vUV, iSeed3, iMidi1_1[0], iMidi1_1[1].xy, iMidi1_1[2], iMidi1_1[3].xy, iMidi1_1[4], iMidi1_1[5].xy);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// SRC B
|
||||
// -----------
|
||||
// OUT: 6 (FX B)
|
||||
|
||||
in vec2 vUV;
|
||||
out vec4 fragColor;
|
||||
|
||||
uniform vec3 iMidi1_2[6];
|
||||
|
||||
void main() {
|
||||
fragColor = src_stage(vUV, iSeed4, iMidi1_2[0], iMidi1_2[1].xy, iMidi1_2[2], iMidi1_2[3].xy, iMidi1_2[4], iMidi1_2[5].xy);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// FX A
|
||||
// -------------
|
||||
// IN: 5 (SRC A)
|
||||
// IN: 7 (FX A)
|
||||
// OUT: 7 (A+B)
|
||||
|
||||
in vec2 vUV;
|
||||
out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
fragColor = fx_stage(vUV, iTex5, iTex7, iSeed5, iMidi2_1[0], iMidi2_1[1].xy, iMidi2_1[2], iMidi2_1[3].xy, iMidi2_1[4], iMidi2_1[5].xy, iMidi2_1[6]);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// FX B
|
||||
// -------------
|
||||
// IN: 6 (SRC B)
|
||||
// IN: 8 (FX B)
|
||||
// OUT: 8 (A+B)
|
||||
|
||||
in vec2 vUV;
|
||||
out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
fragColor = fx_stage(vUV, iTex6, iTex8, iSeed6, iMidi2_2[0], iMidi2_2[1].xy, iMidi2_2[2], iMidi2_2[3].xy, iMidi2_2[4], iMidi2_2[5].xy, iMidi2_2[6]);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// A+B
|
||||
// ------------
|
||||
// IN: 7 (FX A)
|
||||
// IN: 8 (FX B)
|
||||
// OUT: 9 (MFX)
|
||||
|
||||
in vec2 vUV;
|
||||
out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
float mix_value = magic(iMidi3_1[1].xy, vec3(1, 0, 0), iSeed7);
|
||||
bool mix_type = magic_trigger(vec3(iMidi3_1[0].x, 0, 0), iSeed7 + 10);
|
||||
|
||||
vec4 color_a = texture(iTex7, vUV);
|
||||
vec4 color_b = texture(iTex8, vUV);
|
||||
|
||||
float k = mean(color_a);
|
||||
|
||||
fragColor = mix(color_b, color_a, mix_type ? step(mix_value, k) : mix_value);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// MFX
|
||||
// ------------
|
||||
// IN: 9 (A+B)
|
||||
// IN: 0 (OUT)
|
||||
// OUT: 0 (OUT)
|
||||
|
||||
in vec2 vUV;
|
||||
out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
vec4 color = fx_stage(vUV, iTex9, iTex0, iSeed8, iMidi2_3[0], iMidi2_3[1].xy, iMidi2_3[2], iMidi2_3[3].xy, iMidi2_3[4], iMidi2_3[5].xy, iMidi2_3[6]);
|
||||
|
||||
color = mix(color, vec4(0), iMidi3_1[0].y);
|
||||
|
||||
fragColor = color;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// OUT
|
||||
// ---
|
||||
|
||||
in vec2 vUV;
|
||||
out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
fragColor = texture(iTex0, vUV);
|
||||
}
|
||||
Reference in New Issue
Block a user