changed ID fields to have more readable names

This commit is contained in:
Valerie Wolfe 2024-04-26 22:44:10 -04:00
parent fcd88cd03b
commit 7668d7a744
5 changed files with 30 additions and 10 deletions

View file

@ -125,20 +125,20 @@ void main() {
#endif #endif
vec3 color = texture2D(gcolor, newcoord).rgb; vec3 color = texture2D(gcolor, newcoord).rgb;
#if colorMode == 0 #if colorMode == MODE_HSV
color = rgb2hsv(color).xyz; color = rgb2hsv(color).xyz;
#endif #endif
vec3 final; vec3 final;
#ifdef dithering #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; vec3 filtered = vec3(dither(color.x, hueMax), dither(color.y, satMax), dither(color.z, valMax)).rgb;
final = hsv2rgb(filtered); final = hsv2rgb(filtered);
#else #else
final = vec3(dither(color.r, colormax.x), dither(color.g, colormax.y), dither(color.b, colormax.z)); final = vec3(dither(color.r, colormax.x), dither(color.g, colormax.y), dither(color.b, colormax.z));
#endif #endif
#else #else
#if colorMode == 0 #if colorMode == MODE_HSV
vec3 filtered = vec3(lightnessStep(color.x, hueMax), lightnessStep(color.y, satMax), lightnessStep(color.z, valMax)).rgb; vec3 filtered = vec3(lightnessStep(color.x, hueMax), lightnessStep(color.y, satMax), lightnessStep(color.z, valMax)).rgb;
final = hsv2rgb(filtered); final = hsv2rgb(filtered);
#else #else
@ -146,7 +146,7 @@ void main() {
#endif #endif
#endif #endif
#if colorMode == 1 && colorDepth == 1 #if colorMode == MODE_RGB && colorDepth == 1
if(final.r == 1) if(final.r == 1)
final = monoColor; final = monoColor;
#endif #endif

View file

@ -1,4 +1,6 @@
#include "/var/color_depth.glsl"
#define colorMode 0 // [0 1] #define colorMode 0 // [0 1]
#define hueBits 2 // [1 2 3 4 5 6 7 8] #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 colorDepth 6 // [1 3 6 8 12 15 18 24]
#define monoPalette 0 // [0 1 2] #define monoPalette 0 // [0 1 2]
#if colorMode == 0 #if colorMode == MODE_HSV
// -- HSV -- // -- HSV --
float bit_max(int bits) { float bit_max(int bits) {
@ -41,11 +43,11 @@
vec3 colormax = vec3(256, 256, 256); vec3 colormax = vec3(256, 256, 256);
#endif #endif
#if monoPalette == 0 #if monoPalette == MONOCHROME_BW
vec3 monoColor = vec3(1, 1, 1); vec3 monoColor = vec3(1, 1, 1);
#elif monoPalette == 1 #elif monoPalette == MONOCHROME_DOTMATRIX
vec3 monoColor = vec3(0.48, 0.72, 0.28); vec3 monoColor = vec3(0.48, 0.72, 0.28);
#elif monoPalette == 2 #elif monoPalette == MONOCHROME_MOTIONSICK
vec3 monoColor = vec3(1, 0, 0); vec3 monoColor = vec3(1, 0, 0);
#endif #endif

View file

@ -1,12 +1,14 @@
#include "/var/world.glsl"
#define worldCurvature 0 // [0 1 2] #define worldCurvature 0 // [0 1 2]
#define worldRadius 512 // [1024 512 256 -256] #define worldRadius 512 // [1024 512 256 -256]
void world_curvature() { void world_curvature() {
#if worldCurvature == 1 #if worldCurvature == CURVATURE_CYLINDER
float z = gl_Position.z * gl_Position.z; float z = gl_Position.z * gl_Position.z;
gl_Position.y -= 2 * z / worldRadius; gl_Position.y -= 2 * z / worldRadius;
#elif worldCurvature == 2 #elif worldCurvature == CURVATURE_ROUND
vec2 xz = gl_Position.xz; vec2 xz = gl_Position.xz;
gl_Position.y -= round(( dot(xz, xz) / worldRadius ) * 8) / 8; gl_Position.y -= round(( dot(xz, xz) / worldRadius ) * 8) / 8;
#endif #endif

View file

@ -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

6
shaders/var/world.glsl Normal file
View file

@ -0,0 +1,6 @@
// world curvature IDs
#define CURVATURE_OFF 0
#define CURVATURE_CYLINDER 1
#define CURVATURE_ROUND 2