feat: generate cp437/sentences with glsl-glyphs

This commit is contained in:
2026-11-08 17:16:33 +01:00
parent fe2a9734f1
commit d604d60369
11 changed files with 460 additions and 391 deletions
+9 -8
View File
@@ -2,6 +2,7 @@
#include inc_magic.glsl
#include inc_functions.glsl
#include inc_cp437.glsl
#include inc_sentences.glsl
#ifndef INC_SRC
#define INC_SRC
@@ -195,13 +196,13 @@ subroutine(src_stage_sub) vec4 src_7(vec2 vUV, int seed, vec3 b1, vec2 f1, vec3
uv2 *= zoom * 20. + 3.;
uv2 += iBeats;
uv2 = mod(uv2, 100.) + 100.;
int start_char = charset_ctrl.x > 0. ? charsets[int(charset.x * CHARSETS) * 2] : 0x01;
int char_span = int((charset_ctrl.x > 0. ? charsets[int(charset.x * CHARSETS) * 2 + 1] : 255));
int start_char = charset_ctrl.x > 0. ? cp437_sets[int(charset.x * CP437_SETS) * 2] : 0x01;
int char_span = int((charset_ctrl.x > 0. ? cp437_sets[int(charset.x * CP437_SETS) * 2 + 1] : 255));
char_span = int(char_span * max(1. - charset.y, 1. / (char_span * .75)));
ivec2 uv2i = ivec2(uv2);
int code = ((charset_ctrl.y < 1. || (uv2i.x % 2 ^ uv2i.y % 2) > 0) ? 1 : 0) * (start_char + int((rand(uv2i) + char_delta) * char_span) % char_span);
uv2 = mod(uv2, 1.);
float f = chr(uv2, code) ? 1. : 0.;
float f = cp437(uv2, code) ? 1. : 0.;
return vec4(f);
}
@@ -228,10 +229,10 @@ subroutine(src_stage_sub) vec4 src_8(vec2 vUV, int seed, vec3 b1, vec2 f1, vec3
vec2 uv2 = uv1;
uv2 *= (1. + zoom) * 12.;
uv2.y += .5;
int s = int(sentence * (SENTENCE_COUNT - 1));
int s = int(sentence * (CP437_SENTENCE_COUNT - 1));
uv2.x += floor(uv2.y) * (h_delta - .5) * 2.;
uv2.y = mix(uv2.y, mod(uv2.y, 1.), h_delta_b.x);
float f = write_sentence(uv2, vec2(-float(lengths[s]) * .5, 0.), s);
float f = cp437_sentence(uv2, vec2(-float(cp437_sentences_lengths[s]) * .5, 0.), s);
return vec4(f);
}
@@ -258,13 +259,13 @@ subroutine(src_stage_sub) vec4 src_9(vec2 vUV, int seed, vec3 b1, vec2 f1, vec3
uv2.x += h_shift;
uv2 *= 15.;
uv2.y += .5;
int s = int(sentence * (SENTENCE_COUNT - 1));
float slen = float(lengths[s]);
int s = int(sentence * (CP437_SENTENCE_COUNT - 1));
float slen = float(cp437_sentences_lengths[s]);
uv2.x += floor(uv2.y) * (h_delta - .5) * 2.;
uv2.x = cmod(uv2.x, slen + 1.);
vec2 uv3 = uv2;
uv3.y = mix(uv3.y, mod(uv3.y, 1.), h_delta_b.x);
float f = write_sentence(uv3, vec2(-slen * .5, 0.), s);
float f = cp437_sentence(uv3, vec2(-slen * .5, 0.), s);
f *= (1. - abs(floor(uv2.y) * .125)) * (1. - abs(floor(uv2.y) * .125));