From 7668d7a744e8542f437441048596c812afa371a2 Mon Sep 17 00:00:00 2001 From: Valerie Date: Fri, 26 Apr 2024 22:44:10 -0400 Subject: [PATCH] changed ID fields to have more readable names --- shaders/composite.fsh | 8 ++++---- shaders/module/color_depth.frag | 10 ++++++---- shaders/module/world.vert | 6 ++++-- shaders/var/color_depth.glsl | 10 ++++++++++ shaders/var/world.glsl | 6 ++++++ 5 files changed, 30 insertions(+), 10 deletions(-) create mode 100644 shaders/var/color_depth.glsl create mode 100644 shaders/var/world.glsl diff --git a/shaders/composite.fsh b/shaders/composite.fsh index 0085211..5c75114 100644 --- a/shaders/composite.fsh +++ b/shaders/composite.fsh @@ -125,20 +125,20 @@ void main() { #endif vec3 color = texture2D(gcolor, newcoord).rgb; - #if colorMode == 0 + #if colorMode == MODE_HSV color = rgb2hsv(color).xyz; #endif vec3 final; #ifdef dithering - #if colorMode == 0 + #if colorMode == MODE_HSV vec3 filtered = vec3(dither(color.x, hueMax), dither(color.y, satMax), dither(color.z, valMax)).rgb; final = hsv2rgb(filtered); #else final = vec3(dither(color.r, colormax.x), dither(color.g, colormax.y), dither(color.b, colormax.z)); #endif #else - #if colorMode == 0 + #if colorMode == MODE_HSV vec3 filtered = vec3(lightnessStep(color.x, hueMax), lightnessStep(color.y, satMax), lightnessStep(color.z, valMax)).rgb; final = hsv2rgb(filtered); #else @@ -146,7 +146,7 @@ void main() { #endif #endif - #if colorMode == 1 && colorDepth == 1 + #if colorMode == MODE_RGB && colorDepth == 1 if(final.r == 1) final = monoColor; #endif diff --git a/shaders/module/color_depth.frag b/shaders/module/color_depth.frag index be240cb..a243a1f 100644 --- a/shaders/module/color_depth.frag +++ b/shaders/module/color_depth.frag @@ -1,4 +1,6 @@ +#include "/var/color_depth.glsl" + #define colorMode 0 // [0 1] #define hueBits 2 // [1 2 3 4 5 6 7 8] @@ -8,7 +10,7 @@ #define colorDepth 6 // [1 3 6 8 12 15 18 24] #define monoPalette 0 // [0 1 2] -#if colorMode == 0 +#if colorMode == MODE_HSV // -- HSV -- float bit_max(int bits) { @@ -41,11 +43,11 @@ vec3 colormax = vec3(256, 256, 256); #endif - #if monoPalette == 0 + #if monoPalette == MONOCHROME_BW vec3 monoColor = vec3(1, 1, 1); - #elif monoPalette == 1 + #elif monoPalette == MONOCHROME_DOTMATRIX vec3 monoColor = vec3(0.48, 0.72, 0.28); - #elif monoPalette == 2 + #elif monoPalette == MONOCHROME_MOTIONSICK vec3 monoColor = vec3(1, 0, 0); #endif diff --git a/shaders/module/world.vert b/shaders/module/world.vert index bc52f2e..a4d4cc0 100644 --- a/shaders/module/world.vert +++ b/shaders/module/world.vert @@ -1,12 +1,14 @@ +#include "/var/world.glsl" + #define worldCurvature 0 // [0 1 2] #define worldRadius 512 // [1024 512 256 -256] void world_curvature() { - #if worldCurvature == 1 + #if worldCurvature == CURVATURE_CYLINDER float z = gl_Position.z * gl_Position.z; gl_Position.y -= 2 * z / worldRadius; - #elif worldCurvature == 2 + #elif worldCurvature == CURVATURE_ROUND vec2 xz = gl_Position.xz; gl_Position.y -= round(( dot(xz, xz) / worldRadius ) * 8) / 8; #endif diff --git a/shaders/var/color_depth.glsl b/shaders/var/color_depth.glsl new file mode 100644 index 0000000..99f57c0 --- /dev/null +++ b/shaders/var/color_depth.glsl @@ -0,0 +1,10 @@ + +// color mode IDs +#define MODE_HSV 0 +#define MODE_RGB 1 + +// monochrome palette IDs +#define MONOCHROME_BW 0 +#define MONOCHROME_DOTMATRIX 1 +#define MONOCHROME_MOTIONSICK 2 + diff --git a/shaders/var/world.glsl b/shaders/var/world.glsl new file mode 100644 index 0000000..d4eac4c --- /dev/null +++ b/shaders/var/world.glsl @@ -0,0 +1,6 @@ + +// world curvature IDs +#define CURVATURE_OFF 0 +#define CURVATURE_CYLINDER 1 +#define CURVATURE_ROUND 2 +