From: John Tsiombikas Date: Tue, 28 Dec 2021 22:07:28 +0000 (+0200) Subject: demosystem X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=andemo;a=commitdiff_plain;h=3b852038f69e28291498c05f115f498c4dd47657 demosystem --- diff --git a/Makefile b/Makefile index 163f01f..fa01441 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,11 @@ dbg = -g #opt = -O3 -ffast-math -fno-strict-aliasing def = -DMINIGLUT_USE_LIBC -DGLEW_STATIC incdir = -Isrc -Ilibs -Ilibs/imago/src -Ilibs/treestore -Ilibs/glew -libdir = -Llibs/unix +libs_path = libs/unix +libdir = -L$(libs_path) + +libs = $(libs_path)/libimago.a $(libs_path)/libtreestore.a $(libs_path)/libanim.a \ + $(libs_path)/libpsys.a CFLAGS = $(warn) $(dbg) $(opt) $(def) $(incdir) -fcommon -MMD LDFLAGS = $(libdir) $(libsys) $(libgl) -limago -lpsys -lanim -ltreestore $(libc) @@ -19,14 +23,14 @@ ifeq ($(sys), mingw) bin = demo.exe libgl = -lopengl32 libsys = -lmingw32 -lgdi32 -lwinmm -mconsole - libdir = -Llibs/w32 + libs_path = libs/w32 libc = -lm else libgl = -lGL -lX11 -lXext libc = -lm -ldl endif -$(bin): $(obj) Makefile +$(bin): $(obj) Makefile $(libs) $(CC) -o $@ $(obj) $(LDFLAGS) -include $(dep) diff --git a/Makefile.android b/Makefile.android index 4a77672..33a7851 100644 --- a/Makefile.android +++ b/Makefile.android @@ -23,6 +23,9 @@ def = -DGLDEF incdir = -Isrc -Ilibs -Ilibs/imago/src -Ilibs/treestore libdir = -Llibs/android +libs = libs/android/libimago.a libs/android/libtreestore.a libs/android/libanim.a \ + libs/android/libpsys.a + CC = $(TC)clang CFLAGS = $(CCSYSROOT) $(ISYS) $(warn) $(dbg) $(opt) $(def) $(incdir) -fPIC -fcommon -MMD LDFLAGS = $(LDSYSROOT) $(libdir) -lm -landroid -llog -lEGL -lGLESv2 -limago -lpsys -lanim -ltreestore @@ -44,7 +47,7 @@ $(name).unsigned.apk: $(lib_so) AndroidManifest.xml cp -r sdr apkbuild/assets aapt package -f -F $@ -I $(PLATFORM_JAR) -M AndroidManifest.xml apkbuild -$(lib_so): $(obj) Makefile.android +$(lib_so): $(obj) Makefile.android $(libs) $(CC) -o $@ -shared -Wl,-soname,$(lib_so) $(obj) $(LDFLAGS) -include $(dep) diff --git a/libs/anim/Makefile b/libs/anim/Makefile index 7e142dd..3260d3c 100644 --- a/libs/anim/Makefile +++ b/libs/anim/Makefile @@ -11,7 +11,7 @@ ifeq ($(sys), android-arm64) lib = ../android/libanim.a endif -CFLAGS = -O3 -ffast-math -fno-strict-aliasing -I.. +CFLAGS = -g -ffast-math -fno-strict-aliasing -I.. $(lib): $(obj) diff --git a/src/demosys.c b/src/demosys.c index 41bfda1..7ef4478 100644 --- a/src/demosys.c +++ b/src/demosys.c @@ -206,7 +206,7 @@ int dsys_add_screen(struct demoscreen *scr) return -1; } anm_set_track_interpolator(&scr->track, ANM_INTERP_LINEAR); - anm_set_track_extrapolator(&scr->track, ANM_EXTRAP_EXTEND); + anm_set_track_extrapolator(&scr->track, ANM_EXTRAP_CLAMP); anm_set_track_default(&scr->track, 0); dsys_screens[dsys_num_screens++] = scr; diff --git a/src/scr/testa.c b/src/scr/testa.c index e5f1bb3..561d8e3 100644 --- a/src/scr/testa.c +++ b/src/scr/testa.c @@ -1,5 +1,6 @@ #include "demo.h" #include "noise.h" +#include "cgmath/cgmath.h" static int init(void); static void destroy(void); @@ -30,13 +31,14 @@ static void draw(void) { int i; float t = dsys_time / 1000.0f; + float gap = cgm_lerp(0, 0.01, scr.vis); glUseProgram(sdr_foo); gl_begin(GL_QUADS); for(i=0; i<16; i++) { - float x0 = i / 8.0f - 1.0f + 0.01; - float x1 = (i + 1) / 8.0f - 1.0f - 0.01; - float y = noise2((float)i * 1.24f, t); + float x0 = i / 8.0f - 1.0f + gap; + float x1 = (i + 1) / 8.0f - 1.0f - gap; + float y = cgm_lerp(1.0f, noise2((float)i * 1.24f, t), scr.vis); gl_vertex2f(x0, -1); gl_vertex2f(x1, -1); gl_vertex2f(x1, y); diff --git a/src/scr/testb.c b/src/scr/testb.c index 548fa0b..fb08f87 100644 --- a/src/scr/testb.c +++ b/src/scr/testb.c @@ -1,5 +1,6 @@ #include "demo.h" #include "noise.h" +#include "cgmath/cgmath.h" static int init(void); static void destroy(void); @@ -7,9 +8,10 @@ static void draw(void); static unsigned int sdr_foo; +static struct demoscreen scr = { "testb", init, destroy, 0, 0, 0, 0, draw }; + void regscr_testb(void) { - static struct demoscreen scr = { "testb", init, destroy, 0, 0, 0, 0, draw }; dsys_add_screen(&scr); } @@ -40,7 +42,7 @@ static void draw(void) y = (i + 0.5f) / (NY/2.0f) - 1.0f; for(j=0; j 1.0f) sz = 1.0f; xr = sz / NX;