feat: update project with glsl-glyphs
This commit is contained in:
@@ -8,7 +8,7 @@ SCREEN_HEIGHT ?= 480
|
||||
RUN_ARGS ?= --project=$(PROJECT_DIR)/project -is=$(SCREEN_HEIGHT) -nmr --auto-save
|
||||
VERSION ?= invar-$(shell grep -Eo '[0-9]+\.[0-9]+\.[0-9]+' $(FORGE_SRC)/configure.ac)
|
||||
SOURCES ?= $(FORGE_SRC)/src/*.h $(FORGE_SRC)/src/*.c $(FORGE_SRC)/hashmap.c/hashmap.c $(FORGE_SRC)/log.c/src/log.c
|
||||
CFLAGS ?= -Ofast -Ofast -march=native -flto -funroll-loops -fprefetch-loop-arrays -fno-exceptions -fopenmp -I$(FORGE_SRC)/include -DGLFW_INCLUDE_NONE -DGLFW_NATIVE_INCLUDE_NONE -DLOG_USE_COLOR -DVERSION=\"$(VERSION)\" -DOPENGL_MAJOR_VERSION=3 -DOPENGL_MINOR_VERSION=1
|
||||
CFLAGS ?= -Ofast -Ofast -march=native -flto -funroll-loops -fprefetch-loop-arrays -fno-exceptions -fopenmp -I$(FORGE_SRC)/include -DGLFW_INCLUDE_NONE -DGLFW_NATIVE_INCLUDE_NONE -DVERSION=\"$(VERSION)\" -DOPENGL_MAJOR_VERSION=3 -DOPENGL_MINOR_VERSION=1
|
||||
LDLIBS ?= -lm -lGL -lglfw -lasound
|
||||
|
||||
# FILES
|
||||
|
||||
+27
-3
@@ -19,6 +19,9 @@ RASP_ROOTFS ?= /run/media/$(shell whoami)/rootfs
|
||||
RELATIVE_PROJECT_PATH ?= /opt/forge-invar
|
||||
RASP_PROJECT_PATH ?= $(RASP_ROOTFS)$(RELATIVE_PROJECT_PATH)
|
||||
|
||||
GLSL_GLYPHS_DIR ?= forge-steel/glsl-glyphs
|
||||
GLSL_GLYPHS ?= $(UV) run --directory $(GLSL_GLYPHS_DIR) glsl-glyphs
|
||||
|
||||
# DOCS
|
||||
|
||||
.PHONY: help
|
||||
@@ -38,12 +41,18 @@ print-%:
|
||||
# FILES
|
||||
|
||||
.venv: uv.lock
|
||||
$(MAKE) -s uv-sync
|
||||
$(MAKE) uv-sync
|
||||
|
||||
sentences.txt:
|
||||
cp sentences.example.txt sentences.txt
|
||||
|
||||
project/inc_sentences.glsl: sentences.txt
|
||||
$(MAKE) glsl-glyphs-sentences
|
||||
|
||||
# ACTIONS
|
||||
|
||||
.PHONY: init
|
||||
init: uv-sync git-submodule-init git-submodule-update sentences ## install project
|
||||
init: uv-sync git-submodule-update sentences ## install project
|
||||
|
||||
.PHONY: update
|
||||
update: uv-upgrade ## update project dependencies
|
||||
@@ -61,7 +70,7 @@ gen-img: uv-run-invar-mode-gen-img ## generate resources/*.png
|
||||
debug-img: uv-run-invar-mode-debug-img ## debug i2c screen with mock data
|
||||
|
||||
.PHONY: sentences
|
||||
sentences: uv-run-invar-mode-sentences ## generate project/inc_sentences.glsl
|
||||
sentences: glsl-glyphs-sentences ## generate project/inc_sentences.glsl
|
||||
|
||||
.PHONY: rasp-init
|
||||
rasp-init: rasp-chmod-opt rasp-rsync rasp-unmount ## init raspberry
|
||||
@@ -114,6 +123,21 @@ ty: .venv ## ty check
|
||||
git-submodule-update: ## prepare git submodules
|
||||
git submodule update --init --recursive
|
||||
|
||||
.PHONY: glsl-glyphs-sentences
|
||||
glsl-glyphs-sentences: sentences.txt ## glsl-glyphs --sentences-only
|
||||
$(GLSL_GLYPHS) \
|
||||
--name cp437 \
|
||||
--functions \
|
||||
--includes \
|
||||
--glyph-names sample/cp437_names.txt \
|
||||
--sentences-only \
|
||||
--sentences-input ../../sentences.txt \
|
||||
--sentences-output ../../project/inc_sentences.glsl
|
||||
|
||||
.PHONY: forge-run
|
||||
forge-run: $(BUILD_DIR)/$(TARGET) ## run locally
|
||||
$(BUILD_DIR)/$(TARGET) $(RUN_ARGS)
|
||||
|
||||
.PHONY: rasp-chmod-opt
|
||||
rasp-chmod-opt: ## chmod remote project
|
||||
sudo chmod -R a+rwx $(RASP_ROOTFS)/opt
|
||||
|
||||
+1
-1
Submodule forge-steel updated: 01cba36eaa...b813c19057
+2
-2
@@ -6,7 +6,7 @@ in vec2 vUV;
|
||||
out vec4 fragColor;
|
||||
|
||||
#include inc_functions.glsl
|
||||
#include inc_cp437.glsl
|
||||
#include inc_write.glsl
|
||||
|
||||
uniform sampler2D iTex0;
|
||||
uniform int iFPS;
|
||||
@@ -18,7 +18,7 @@ void main() {
|
||||
// vec2 uv = 1 - vUV;
|
||||
vec2 uv = vUV;
|
||||
vec3 c = texture(iTex0, uv).xyz;
|
||||
c = mix(c, 1. - c, iDemo * write_int(uv * 20., vec2(1.), iFPS, 2));
|
||||
c = mix(c, 1. - c, iDemo * write_int(uv * 20., vec2(1.), min(99, iFPS), 2));
|
||||
c = mix(c, 1. - c, iDemo * write_5(uv * 20., vec2(1., 18.), textDEMO));
|
||||
fragColor = vec4(c, 1);
|
||||
}
|
||||
|
||||
+4
-3
@@ -267,8 +267,9 @@ vec4 fx_9(vec2 vUV, sampler2D previous, sampler2D feedback, int seed, vec3 b1, v
|
||||
float k1 = 100. * (1. - zoom) + 10.;
|
||||
float inv_k = 1. / k1;
|
||||
uv2 = floor(uv2 * k1) * inv_k;
|
||||
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 charset_index = int(charset.x * (CP437_SETS - 1));
|
||||
int start_char = charset_ctrl.x > 0. ? cp437_sets[charset_index * 2] : 0x01;
|
||||
int char_span = int((charset_ctrl.x > 0. ? cp437_sets[charset_index * 2 + 1] : 255));
|
||||
char_span = int(char_span * max(1. - charset.y, 1. / (char_span * .75)));
|
||||
ivec2 uv2i = ivec2(uv2 * k1);
|
||||
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);
|
||||
@@ -277,7 +278,7 @@ vec4 fx_9(vec2 vUV, sampler2D previous, sampler2D feedback, int seed, vec3 b1, v
|
||||
+ reframe(previous, uv2 + vec2(1., 1.) * inv_k * .125).xyz * .2
|
||||
+ reframe(previous, uv2 + vec2(0., 1.) * inv_k * .125).xyz * .2
|
||||
+ reframe(previous, uv2 + vec2(.5, .5) * inv_k * .125).xyz * .2;
|
||||
c = chr(mod(uv1 * k1, 1.), code) ? c : vec3(0.);
|
||||
c = cp437(mod(uv1 * k1, 1.), code) ? c : vec3(0.);
|
||||
|
||||
return fx_master(c0, c, seed, m0);
|
||||
}
|
||||
|
||||
+10
-8
@@ -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
|
||||
@@ -311,13 +312,14 @@ vec4 src_7(vec2 vUV, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2
|
||||
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 charset_index = int(charset.x * (CP437_SETS - 1));
|
||||
int start_char = charset_ctrl.x > 0. ? cp437_sets[charset_index * 2] : 0x01;
|
||||
int char_span = int((charset_ctrl.x > 0. ? cp437_sets[charset_index * 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);
|
||||
}
|
||||
@@ -344,10 +346,10 @@ vec4 src_8(vec2 vUV, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2
|
||||
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);
|
||||
}
|
||||
@@ -374,13 +376,13 @@ vec4 src_9(vec2 vUV, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2
|
||||
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));
|
||||
|
||||
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
../forge-steel/default/inc_write.glsl
|
||||
Reference in New Issue
Block a user