summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2021-10-01 16:35:08 -0700
committerVito Caputo <vcaputo@pengaru.com>2021-10-01 16:35:08 -0700
commitb686b405c6a22b26e9b8082c92ed91513608bea3 (patch)
tree0000f671501863a8ee9b536ba869221d0f6710f9 /src/modules
parentd1da5500261e96efe0ede06fbebb32f0e191f3c1 (diff)
*: librototiller->libtil
Largely mechanical rename of librototiller -> libtil, but introducing a til_ prefix to all librototiller (now libtil) functions and types where a rototiller prefix was absent. This is just a step towards a more libized librototiller, and til is just a nicer to type/read prefix than rototiller_.
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/compose/compose.c47
-rw-r--r--src/modules/drizzle/drizzle.c25
-rw-r--r--src/modules/flui2d/flui2d.c32
-rw-r--r--src/modules/julia/julia.c14
-rw-r--r--src/modules/meta2d/meta2d.c17
-rw-r--r--src/modules/montage/montage.c53
-rw-r--r--src/modules/pixbounce/pixbounce.c10
-rw-r--r--src/modules/plasma/plasma.c14
-rw-r--r--src/modules/plato/plato.c18
-rw-r--r--src/modules/ray/ray.c18
-rw-r--r--src/modules/roto/roto.c14
-rw-r--r--src/modules/rtv/rtv.c131
-rw-r--r--src/modules/snow/snow.c16
-rw-r--r--src/modules/sparkler/burst.c16
-rw-r--r--src/modules/sparkler/helpers.h7
-rw-r--r--src/modules/sparkler/particle.h11
-rw-r--r--src/modules/sparkler/particles.c26
-rw-r--r--src/modules/sparkler/particles.h9
-rw-r--r--src/modules/sparkler/rocket.c9
-rw-r--r--src/modules/sparkler/simple.c9
-rw-r--r--src/modules/sparkler/spark.c9
-rw-r--r--src/modules/sparkler/sparkler.c38
-rw-r--r--src/modules/sparkler/xplode.c9
-rw-r--r--src/modules/spiro/spiro.c23
-rw-r--r--src/modules/stars/stars.c25
-rw-r--r--src/modules/submit/submit.c32
-rw-r--r--src/modules/swab/swab.c20
-rw-r--r--src/modules/swarm/swarm.c12
28 files changed, 338 insertions, 326 deletions
diff --git a/src/modules/compose/compose.c b/src/modules/compose/compose.c
index 5cf994e..bf3f125 100644
--- a/src/modules/compose/compose.c
+++ b/src/modules/compose/compose.c
@@ -1,11 +1,12 @@
#include <stdlib.h>
#include <time.h>
-#include "fb.h"
-#include "rototiller.h"
-#include "settings.h"
+#include "til.h"
+#include "til_fb.h"
+#include "til_settings.h"
+#include "til_util.h"
+
#include "txt/txt.h"
-#include "util.h"
/* Copyright (C) 2020 - Vito Caputo <vcaputo@pengaru.com> */
@@ -23,28 +24,28 @@
*/
typedef struct compose_layer_t {
- const rototiller_module_t *module;
- void *module_ctxt;
- char *settings;
+ const til_module_t *module;
+ void *module_ctxt;
+ char *settings;
} compose_layer_t;
typedef struct compose_context_t {
- unsigned n_cpus;
+ unsigned n_cpus;
- size_t n_layers;
- compose_layer_t layers[];
+ size_t n_layers;
+ compose_layer_t layers[];
} compose_context_t;
static void * compose_create_context(unsigned ticks, unsigned num_cpus);
static void compose_destroy_context(void *context);
-static void compose_prepare_frame(void *context, unsigned ticks, unsigned n_cpus, fb_fragment_t *fragment, rototiller_fragmenter_t *res_fragmenter);
-static int compose_setup(const settings_t *settings, setting_desc_t **next_setting);
+static void compose_prepare_frame(void *context, unsigned ticks, unsigned n_cpus, til_fb_fragment_t *fragment, til_fragmenter_t *res_fragmenter);
+static int compose_setup(const til_settings_t *settings, til_setting_desc_t **next_setting);
static char *compose_default_layers[] = { "drizzle", "stars", "spiro", "plato", NULL };
static char **compose_layers;
-rototiller_module_t compose_module = {
+til_module_t compose_module = {
.create_context = compose_create_context,
.destroy_context = compose_destroy_context,
.prepare_frame = compose_prepare_frame,
@@ -72,9 +73,9 @@ static void * compose_create_context(unsigned ticks, unsigned num_cpus)
ctxt->n_cpus = num_cpus;
for (int i = 0; i < n; i++) {
- const rototiller_module_t *module;
+ const til_module_t *module;
- module = rototiller_lookup_module(layers[i]);
+ module = til_lookup_module(layers[i]);
ctxt->layers[i].module = module;
if (module->create_context)
@@ -99,26 +100,26 @@ static void compose_destroy_context(void *context)
}
-static void compose_prepare_frame(void *context, unsigned ticks, unsigned n_cpus, fb_fragment_t *fragment, rototiller_fragmenter_t *res_fragmenter)
+static void compose_prepare_frame(void *context, unsigned ticks, unsigned n_cpus, til_fb_fragment_t *fragment, til_fragmenter_t *res_fragmenter)
{
compose_context_t *ctxt = context;
- fb_fragment_zero(fragment);
+ til_fb_fragment_zero(fragment);
for (int i = 0; i < ctxt->n_layers; i++)
- rototiller_module_render(ctxt->layers[i].module, ctxt->layers[i].module_ctxt, ticks, fragment);
+ til_module_render(ctxt->layers[i].module, ctxt->layers[i].module_ctxt, ticks, fragment);
}
-static int compose_setup(const settings_t *settings, setting_desc_t **next_setting)
+static int compose_setup(const til_settings_t *settings, til_setting_desc_t **next_setting)
{
const char *layers;
- layers = settings_get_value(settings, "layers");
+ layers = til_settings_get_value(settings, "layers");
if (!layers) {
int r;
- r = setting_desc_clone(&(setting_desc_t){
+ r = til_setting_desc_clone(&(til_setting_desc_t){
.name = "Colon-Separated List Of Module Layers, In Draw Order",
.key = "layers",
.preferred = "drizzle:stars:spiro:plato",
@@ -132,12 +133,12 @@ static int compose_setup(const settings_t *settings, setting_desc_t **next_setti
/* turn layers colon-separated list into a null-terminated array of strings */
{
- const rototiller_module_t **modules;
+ const til_module_t **modules;
size_t n_modules;
char *toklayers, *layer;
int n = 2;
- rototiller_get_modules(&modules, &n_modules);
+ til_get_modules(&modules, &n_modules);
toklayers = strdup(layers);
if (!toklayers)
diff --git a/src/modules/drizzle/drizzle.c b/src/modules/drizzle/drizzle.c
index f546cea..f0ed956 100644
--- a/src/modules/drizzle/drizzle.c
+++ b/src/modules/drizzle/drizzle.c
@@ -17,9 +17,10 @@
#include <stdlib.h>
#include <unistd.h>
-#include "fb.h"
+#include "til.h"
+#include "til_fb.h"
+
#include "puddle/puddle.h"
-#include "rototiller.h"
#define PUDDLE_SIZE 512
#define DRIZZLE_CNT 20
@@ -92,15 +93,15 @@ static void drizzle_destroy_context(void *context)
}
-static int drizzle_fragmenter(void *context, const fb_fragment_t *fragment, unsigned number, fb_fragment_t *res_fragment)
+static int drizzle_fragmenter(void *context, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment)
{
drizzle_context_t *ctxt = context;
- return fb_fragment_slice_single(fragment, ctxt->n_cpus, number, res_fragment);
+ return til_fb_fragment_slice_single(fragment, ctxt->n_cpus, number, res_fragment);
}
-static void drizzle_prepare_frame(void *context, unsigned ticks, unsigned n_cpus, fb_fragment_t *fragment, rototiller_fragmenter_t *res_fragmenter)
+static void drizzle_prepare_frame(void *context, unsigned ticks, unsigned n_cpus, til_fb_fragment_t *fragment, til_fragmenter_t *res_fragmenter)
{
drizzle_context_t *ctxt = context;
@@ -124,7 +125,7 @@ static void drizzle_prepare_frame(void *context, unsigned ticks, unsigned n_cpus
}
-static void drizzle_render_fragment(void *context, unsigned ticks, unsigned cpu, fb_fragment_t *fragment)
+static void drizzle_render_fragment(void *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment)
{
drizzle_context_t *ctxt = context;
float xf = 1.f / (float)fragment->frame_width;
@@ -142,7 +143,7 @@ static void drizzle_render_fragment(void *context, unsigned ticks, unsigned cpu,
color.z = puddle_sample(ctxt->puddle, &coord);
pixel = color_to_uint32(color);
- fb_fragment_put_pixel_unchecked(fragment, x, y, pixel);
+ til_fb_fragment_put_pixel_unchecked(fragment, x, y, pixel);
coord.x += xf;
}
@@ -152,7 +153,7 @@ static void drizzle_render_fragment(void *context, unsigned ticks, unsigned cpu,
}
-static int drizzle_setup(const settings_t *settings, setting_desc_t **next_setting)
+static int drizzle_setup(const til_settings_t *settings, til_setting_desc_t **next_setting)
{
const char *viscosity;
const char *values[] = {
@@ -163,15 +164,15 @@ static int drizzle_setup(const settings_t *settings, setting_desc_t **next_setti
NULL
};
- viscosity = settings_get_value(settings, "viscosity");
+ viscosity = til_settings_get_value(settings, "viscosity");
if (!viscosity) {
int r;
- r = setting_desc_clone(&(setting_desc_t){
+ r = til_setting_desc_clone(&(til_setting_desc_t){
.name = "Puddle Viscosity",
.key = "viscosity",
.regex = "\\.[0-9]+",
- .preferred = SETTINGS_STR(DEFAULT_VISCOSITY),
+ .preferred = TIL_SETTINGS_STR(DEFAULT_VISCOSITY),
.values = values,
.annotations = NULL
}, next_setting);
@@ -187,7 +188,7 @@ static int drizzle_setup(const settings_t *settings, setting_desc_t **next_setti
}
-rototiller_module_t drizzle_module = {
+til_module_t drizzle_module = {
.create_context = drizzle_create_context,
.destroy_context = drizzle_destroy_context,
.prepare_frame = drizzle_prepare_frame,
diff --git a/src/modules/flui2d/flui2d.c b/src/modules/flui2d/flui2d.c
index 71238cd..3b0e629 100644
--- a/src/modules/flui2d/flui2d.c
+++ b/src/modules/flui2d/flui2d.c
@@ -3,9 +3,9 @@
#include <math.h>
#include <stdlib.h>
-#include "fb.h"
-#include "rototiller.h"
-#include "settings.h"
+#include "til.h"
+#include "til_fb.h"
+#include "til_settings.h"
/* This code is almost entirely taken from the paper:
@@ -208,14 +208,14 @@ static void flui2d_destroy_context(void *context)
}
-static int flui2d_fragmenter(void *context, const fb_fragment_t *fragment, unsigned number, fb_fragment_t *res_fragment)
+static int flui2d_fragmenter(void *context, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment)
{
- return fb_fragment_tile_single(fragment, 64, number, res_fragment);
+ return til_fb_fragment_tile_single(fragment, 64, number, res_fragment);
}
/* Prepare a frame for concurrent drawing of fragment using multiple fragments */
-static void flui2d_prepare_frame(void *context, unsigned ticks, unsigned n_cpus, fb_fragment_t *fragment, rototiller_fragmenter_t *res_fragmenter)
+static void flui2d_prepare_frame(void *context, unsigned ticks, unsigned n_cpus, til_fb_fragment_t *fragment, til_fragmenter_t *res_fragmenter)
{
flui2d_context_t *ctxt = context;
float r = (ticks % (unsigned)(2 * M_PI * 1000)) * .001f;
@@ -247,7 +247,7 @@ static void flui2d_prepare_frame(void *context, unsigned ticks, unsigned n_cpus,
/* Draw a the flui2d densities */
-static void flui2d_render_fragment(void *context, unsigned ticks, unsigned cpu, fb_fragment_t *fragment)
+static void flui2d_render_fragment(void *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment)
{
flui2d_context_t *ctxt = context;
@@ -277,14 +277,14 @@ static void flui2d_render_fragment(void *context, unsigned ticks, unsigned cpu,
pixel = ((float)dens * 256.f);
pixel = pixel << 16 | pixel << 8 | pixel;
- fb_fragment_put_pixel_unchecked(fragment, x, y, pixel);
+ til_fb_fragment_put_pixel_unchecked(fragment, x, y, pixel);
}
}
}
/* Settings hooks for configurable variables */
-static int flui2d_setup(const settings_t *settings, setting_desc_t **next_setting)
+static int flui2d_setup(const til_settings_t *settings, til_setting_desc_t **next_setting)
{
const char *viscosity;
const char *diffusion;
@@ -301,15 +301,15 @@ static int flui2d_setup(const settings_t *settings, setting_desc_t **next_settin
};
- viscosity = settings_get_value(settings, "viscosity");
+ viscosity = til_settings_get_value(settings, "viscosity");
if (!viscosity) {
int r;
- r = setting_desc_clone(&(setting_desc_t){
+ r = til_setting_desc_clone(&(til_setting_desc_t){
.name = "Fluid Viscosity",
.key = "viscosity",
.regex = "\\.[0-9]+",
- .preferred = SETTINGS_STR(DEFAULT_VISCOSITY),
+ .preferred = TIL_SETTINGS_STR(DEFAULT_VISCOSITY),
.values = values,
.annotations = NULL
}, next_setting);
@@ -319,15 +319,15 @@ static int flui2d_setup(const settings_t *settings, setting_desc_t **next_settin
return 1;
}
- diffusion = settings_get_value(settings, "diffusion");
+ diffusion = til_settings_get_value(settings, "diffusion");
if (!diffusion) {
int r;
- r = setting_desc_clone(&(setting_desc_t){
+ r = til_setting_desc_clone(&(til_setting_desc_t){
.name = "Fluid Diffusion",
.key = "diffusion",
.regex = "\\.[0-9]+",
- .preferred = SETTINGS_STR(DEFAULT_DIFFUSION),
+ .preferred = TIL_SETTINGS_STR(DEFAULT_DIFFUSION),
.values = values,
.annotations = NULL
}, next_setting);
@@ -345,7 +345,7 @@ static int flui2d_setup(const settings_t *settings, setting_desc_t **next_settin
}
-rototiller_module_t flui2d_module = {
+til_module_t flui2d_module = {
.create_context = flui2d_create_context,
.destroy_context = flui2d_destroy_context,
.prepare_frame = flui2d_prepare_frame,
diff --git a/src/modules/julia/julia.c b/src/modules/julia/julia.c
index 61515bd..5e7a350 100644
--- a/src/modules/julia/julia.c
+++ b/src/modules/julia/julia.c
@@ -3,8 +3,8 @@
#include <math.h>
#include <stdlib.h>
-#include "fb.h"
-#include "rototiller.h"
+#include "til.h"
+#include "til_fb.h"
/* Copyright (C) 2017 Vito Caputo <vcaputo@pengaru.com> */
@@ -102,16 +102,16 @@ static inline unsigned julia_iter(float real, float imag, float creal, float cim
}
-static int julia_fragmenter(void *context, const fb_fragment_t *fragment, unsigned number, fb_fragment_t *res_fragment)
+static int julia_fragmenter(void *context, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment)
{
julia_context_t *ctxt = context;
- return fb_fragment_slice_single(fragment, ctxt->n_cpus, number, res_fragment);
+ return til_fb_fragment_slice_single(fragment, ctxt->n_cpus, number, res_fragment);
}
/* Prepare a frame for concurrent drawing of fragment using multiple fragments */
-static void julia_prepare_frame(void *context, unsigned ticks, unsigned n_cpus, fb_fragment_t *fragment, rototiller_fragmenter_t *res_fragmenter)
+static void julia_prepare_frame(void *context, unsigned ticks, unsigned n_cpus, til_fb_fragment_t *fragment, til_fragmenter_t *res_fragmenter)
{
julia_context_t *ctxt = context;
@@ -139,7 +139,7 @@ static void julia_prepare_frame(void *context, unsigned ticks, unsigned n_cpus,
/* Draw a morphing Julia set */
-static void julia_render_fragment(void *context, unsigned ticks, unsigned cpu, fb_fragment_t *fragment)
+static void julia_render_fragment(void *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment)
{
julia_context_t *ctxt = context;
unsigned x, y;
@@ -160,7 +160,7 @@ static void julia_render_fragment(void *context, unsigned ticks, unsigned cpu, f
}
-rototiller_module_t julia_module = {
+til_module_t julia_module = {
.create_context = julia_create_context,
.destroy_context = julia_destroy_context,
.prepare_frame = julia_prepare_frame,
diff --git a/src/modules/meta2d/meta2d.c b/src/modules/meta2d/meta2d.c
index 56f9b25..18af219 100644
--- a/src/modules/meta2d/meta2d.c
+++ b/src/modules/meta2d/meta2d.c
@@ -19,9 +19,10 @@
#include <stdlib.h>
#include <unistd.h>
+#include "til.h"
+#include "til_fb.h"
+
#include "din/din.h"
-#include "fb.h"
-#include "rototiller.h"
#include "v2f.h"
#include "v3f.h"
@@ -100,15 +101,15 @@ static void meta2d_destroy_context(void *context)
}
-static int meta2d_fragmenter(void *context, const fb_fragment_t *fragment, unsigned number, fb_fragment_t *res_fragment)
+static int meta2d_fragmenter(void *context, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment)
{
meta2d_context_t *ctxt = context;
- return fb_fragment_slice_single(fragment, ctxt->n_cpus, number, res_fragment);
+ return til_fb_fragment_slice_single(fragment, ctxt->n_cpus, number, res_fragment);
}
-static void meta2d_prepare_frame(void *context, unsigned ticks, unsigned n_cpus, fb_fragment_t *fragment, rototiller_fragmenter_t *res_fragmenter)
+static void meta2d_prepare_frame(void *context, unsigned ticks, unsigned n_cpus, til_fb_fragment_t *fragment, til_fragmenter_t *res_fragmenter)
{
meta2d_context_t *ctxt = context;
@@ -185,7 +186,7 @@ static void meta2d_prepare_frame(void *context, unsigned ticks, unsigned n_cpus,
}
-static void meta2d_render_fragment(void *context, unsigned ticks, unsigned cpu, fb_fragment_t *fragment)
+static void meta2d_render_fragment(void *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment)
{
meta2d_context_t *ctxt = context;
float xf = 2.f / (float)fragment->frame_width;
@@ -217,13 +218,13 @@ static void meta2d_render_fragment(void *context, unsigned ticks, unsigned cpu,
color = (v3f_t){};
pixel = color_to_uint32(color);
- fb_fragment_put_pixel_unchecked(fragment, x, y, pixel);
+ til_fb_fragment_put_pixel_unchecked(fragment, x, y, pixel);
}
}
}
-rototiller_module_t meta2d_module = {
+til_module_t meta2d_module = {
.create_context = meta2d_create_context,
.destroy_context = meta2d_destroy_context,
.prepare_frame = meta2d_prepare_frame,
diff --git a/src/modules/montage/montage.c b/src/modules/montage/montage.c
index f791ac1..2af0457 100644
--- a/src/modules/montage/montage.c
+++ b/src/modules/montage/montage.c
@@ -2,15 +2,14 @@
#include <stdlib.h>
#include <time.h>
-#include "fb.h"
-#include "rototiller.h"
-#include "settings.h"
-#include "util.h"
+#include "til.h"
+#include "til_fb.h"
+#include "til_util.h"
/* Copyright (C) 2019 - Vito Caputo <vcaputo@pengaru.com> */
typedef struct montage_context_t {
- const rototiller_module_t **modules;
+ const til_module_t **modules;
void **contexts;
size_t n_modules;
unsigned n_cpus;
@@ -19,11 +18,11 @@ typedef struct montage_context_t {
static void setup_next_module(montage_context_t *ctxt);
static void * montage_create_context(unsigned ticks, unsigned num_cpus);
static void montage_destroy_context(void *context);
-static void montage_prepare_frame(void *context, unsigned ticks, unsigned n_cpus, fb_fragment_t *fragment, rototiller_fragmenter_t *res_fragmenter);
-static void montage_render_fragment(void *context, unsigned ticks, unsigned cpu, fb_fragment_t *fragment);
+static void montage_prepare_frame(void *context, unsigned ticks, unsigned n_cpus, til_fb_fragment_t *fragment, til_fragmenter_t *res_fragmenter);
+static void montage_render_fragment(void *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment);
-rototiller_module_t montage_module = {
+til_module_t montage_module = {
.create_context = montage_create_context,
.destroy_context = montage_destroy_context,
.prepare_frame = montage_prepare_frame,
@@ -35,28 +34,28 @@ rototiller_module_t montage_module = {
static void * montage_create_context(unsigned ticks, unsigned num_cpus)
{
- const rototiller_module_t **modules, *rtv_module, *compose_module;
- size_t n_modules;
- montage_context_t *ctxt;
+ const til_module_t **modules, *rtv_module, *compose_module;
+ size_t n_modules;
+ montage_context_t *ctxt;
ctxt = calloc(1, sizeof(montage_context_t));
if (!ctxt)
return NULL;
- rototiller_get_modules(&modules, &n_modules);
+ til_get_modules(&modules, &n_modules);
- ctxt->modules = calloc(n_modules, sizeof(rototiller_module_t *));
+ ctxt->modules = calloc(n_modules, sizeof(til_module_t *));
if (!ctxt->modules) {
free(ctxt);
return NULL;
}
- rtv_module = rototiller_lookup_module("rtv");
- compose_module = rototiller_lookup_module("compose");
+ rtv_module = til_lookup_module("rtv");
+ compose_module = til_lookup_module("compose");
for (size_t i = 0; i < n_modules; i++) {
- const rototiller_module_t *module = modules[i];
+ const til_module_t *module = modules[i];
if (module == &montage_module || /* prevents recursion */
module == rtv_module || /* also prevents recursion, rtv can run montage */
@@ -88,7 +87,7 @@ static void * montage_create_context(unsigned ticks, unsigned num_cpus)
}
for (size_t i = 0; i < ctxt->n_modules; i++) {
- const rototiller_module_t *module = ctxt->modules[i];
+ const til_module_t *module = ctxt->modules[i];
if (module->create_context) /* FIXME errors */
ctxt->contexts[i] = module->create_context(ticks, 1);
@@ -103,7 +102,7 @@ static void montage_destroy_context(void *context)
montage_context_t *ctxt = context;
for (int i = 0; i < ctxt->n_modules; i++) {
- const rototiller_module_t *module = ctxt->modules[i];
+ const til_module_t *module = ctxt->modules[i];
if (!ctxt->contexts[i])
continue;
@@ -118,8 +117,8 @@ static void montage_destroy_context(void *context)
-/* this is a hacked up derivative of fb_fragment_tile_single() */
-static int montage_fragment_tile(const fb_fragment_t *fragment, unsigned tile_width, unsigned tile_height, unsigned number, fb_fragment_t *res_fragment)
+/* this is a hacked up derivative of til_fb_fragment_tile_single() */
+static int montage_fragment_tile(const til_fb_fragment_t *fragment, unsigned tile_width, unsigned tile_height, unsigned number, til_fb_fragment_t *res_fragment)
{
unsigned w = fragment->width / tile_width, h = fragment->height / tile_height;
unsigned x, y, xoff, yoff;
@@ -166,7 +165,7 @@ static int montage_fragment_tile(const fb_fragment_t *fragment, unsigned tile_wi
* 1. it divides the frame into subfragments for threaded rendering
* 2. it determines which modules will be rendered where via fragment->number
*/
-static int montage_fragmenter(void *context, const fb_fragment_t *fragment, unsigned number, fb_fragment_t *res_fragment)
+static int montage_fragmenter(void *context, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment)
{
montage_context_t *ctxt = context;
float root = sqrtf(ctxt->n_modules);
@@ -186,7 +185,7 @@ static int montage_fragmenter(void *context, const fb_fragment_t *fragment, unsi
-static void montage_prepare_frame(void *context, unsigned ticks, unsigned n_cpus, fb_fragment_t *fragment, rototiller_fragmenter_t *res_fragmenter)
+static void montage_prepare_frame(void *context, unsigned ticks, unsigned n_cpus, til_fb_fragment_t *fragment, til_fragmenter_t *res_fragmenter)
{
montage_context_t *ctxt = context;
@@ -194,13 +193,13 @@ static void montage_prepare_frame(void *context, unsigned ticks, unsigned n_cpus
}
-static void montage_render_fragment(void *context, unsigned ticks, unsigned cpu, fb_fragment_t *fragment)
+static void montage_render_fragment(void *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment)
{
- montage_context_t *ctxt = context;
- const rototiller_module_t *module = ctxt->modules[fragment->number];
+ montage_context_t *ctxt = context;
+ const til_module_t *module = ctxt->modules[fragment->number];
if (fragment->number >= ctxt->n_modules) {
- fb_fragment_zero(fragment);
+ til_fb_fragment_zero(fragment);
return;
}
@@ -212,7 +211,7 @@ static void montage_render_fragment(void *context, unsigned ticks, unsigned cpu,
* fashion for now. FIXME TODO: move this into rototiller.c
*/
if (module->prepare_frame) {
- rototiller_fragmenter_t unused;
+ til_fragmenter_t unused;
/* XXX FIXME: ignoring the fragmenter here is a violation of the module API,
* rototiller.c should have a module render interface with explicit non-threading
diff --git a/src/modules/pixbounce/pixbounce.c b/src/modules/pixbounce/pixbounce.c
index 893016f..ff397be 100644
--- a/src/modules/pixbounce/pixbounce.c
+++ b/src/modules/pixbounce/pixbounce.c
@@ -2,8 +2,8 @@
#include <time.h>
#include <unistd.h>
+#include "til.h"
#include "draw.h"
-#include "rototiller.h"
/* Copyright (C) 2018-19 Philip J. Freeman <elektron@halo.nu> */
@@ -135,7 +135,7 @@ static void pixbounce_destroy_context(void *context)
free(context);
}
-static void pixbounce_render_fragment(void *context, unsigned ticks, unsigned cpu, fb_fragment_t *fragment)
+static void pixbounce_render_fragment(void *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment)
{
pixbounce_context_t *ctxt = context;
@@ -143,7 +143,7 @@ static void pixbounce_render_fragment(void *context, unsigned ticks, unsigned cp
int width = fragment->width, height = fragment->height;
/* blank the frame */
- fb_fragment_zero(fragment);
+ til_fb_fragment_zero(fragment);
/* check for very small fragment */
if(pix_width*2>width||pix_height*2>height)
@@ -164,7 +164,7 @@ static void pixbounce_render_fragment(void *context, unsigned ticks, unsigned cp
for(int cursor_x=0; cursor_x < pix_width*multiplier; cursor_x++) {
int pix_offset = ((cursor_y/multiplier)*pix_width) + (cursor_x/multiplier);
if(pix_map[ctxt->pix_num][pix_offset] == 0) continue;
- fb_fragment_put_pixel_unchecked(
+ til_fb_fragment_put_pixel_unchecked(
fragment, ctxt->x+cursor_x, ctxt->y+cursor_y,
makergb(0xFF, 0xFF, 0xFF, 1)
);
@@ -192,7 +192,7 @@ static void pixbounce_render_fragment(void *context, unsigned ticks, unsigned cp
ctxt->y = ctxt->y+ctxt->y_dir;
}
-rototiller_module_t pixbounce_module = {
+til_module_t pixbounce_module = {
.create_context = pixbounce_create_context,
.destroy_context = pixbounce_destroy_context,
.render_fragment = pixbounce_render_fragment,
diff --git a/src/modules/plasma/plasma.c b/src/modules/plasma/plasma.c
index 23d7ef2..b970205 100644
--- a/src/modules/plasma/plasma.c
+++ b/src/modules/plasma/plasma.c
@@ -3,8 +3,8 @@
#include <stdint.h>
#include <stdlib.h>
-#include "fb.h"
-#include "rototiller.h"
+#include "til.h"
+#include "til_fb.h"
/* Copyright (C) 2017 Vito Caputo <vcaputo@pengaru.com> */
@@ -72,16 +72,16 @@ static void plasma_destroy_context(void *context)
}
-static int plasma_fragmenter(void *context, const fb_fragment_t *fragment, unsigned number, fb_fragment_t *res_fragment)
+static int plasma_fragmenter(void *context, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment)
{
plasma_context_t *ctxt = context;
- return fb_fragment_slice_single(fragment, ctxt->n_cpus, number, res_fragment);
+ return til_fb_fragment_slice_single(fragment, ctxt->n_cpus, number, res_fragment);
}
/* Prepare a frame for concurrent drawing of fragment using multiple fragments */
-static void plasma_prepare_frame(void *context, unsigned ticks, unsigned n_cpus, fb_fragment_t *fragment, rototiller_fragmenter_t *res_fragmenter)
+static void plasma_prepare_frame(void *context, unsigned ticks, unsigned n_cpus, til_fb_fragment_t *fragment, til_fragmenter_t *res_fragmenter)
{
plasma_context_t *ctxt = context;
@@ -92,7 +92,7 @@ static void plasma_prepare_frame(void *context, unsigned ticks, unsigned n_cpus,
/* Draw a plasma effect */
-static void plasma_render_fragment(void *context, unsigned ticks, unsigned cpu, fb_fragment_t *fragment)
+static void plasma_render_fragment(void *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment)
{
plasma_context_t *ctxt = context;
int xstep = PLASMA_WIDTH / fragment->frame_width;
@@ -161,7 +161,7 @@ static void plasma_render_fragment(void *context, unsigned ticks, unsigned cpu,
}
-rototiller_module_t plasma_module = {
+til_module_t plasma_module = {
.create_context = plasma_create_context,
.destroy_context = plasma_destroy_context,
.prepare_frame = plasma_prepare_frame,
diff --git a/src/modules/plato/plato.c b/src/modules/plato/plato.c
index 8f0810e..d5c1357 100644
--- a/src/modules/plato/plato.c
+++ b/src/modules/plato/plato.c
@@ -44,8 +44,8 @@
#include <unistd.h>
#include <math.h>
-#include "fb.h"
-#include "rototiller.h"
+#include "til.h"
+#include "til_fb.h"
typedef struct plato_context_t {
@@ -546,7 +546,7 @@ static inline uint32_t color_to_uint32(v3f_t color) {
}
-static void draw_line(fb_fragment_t *fragment, int x1, int y1, int x2, int y2)
+static void draw_line(til_fb_fragment_t *fragment, int x1, int y1, int x2, int y2)
{
int x_delta = x2 - x1;
int y_delta = y2 - y1;
@@ -564,7 +564,7 @@ static void draw_line(fb_fragment_t *fragment, int x1, int y1, int x2, int y2)
minor -= x_delta;
}
- fb_fragment_put_pixel_checked(fragment, x1, y1, 0xffffffff);
+ til_fb_fragment_put_pixel_checked(fragment, x1, y1, 0xffffffff);
}
} else {
/* Y-major */
@@ -574,14 +574,14 @@ static void draw_line(fb_fragment_t *fragment, int x1, int y1, int x2, int y2)
minor -= y_delta;
}
- fb_fragment_put_pixel_checked(fragment, x1, y1, 0xffffffff);
+ til_fb_fragment_put_pixel_checked(fragment, x1, y1, 0xffffffff);
}
}
}
#define ZCONST 3.f
-static void draw_polyhedron(const polyhedron_t *polyhedron, m4f_t *transform, fb_fragment_t *fragment)
+static void draw_polyhedron(const polyhedron_t *polyhedron, m4f_t *transform, til_fb_fragment_t *fragment)
{
unsigned n_faces = polyhedron->edge_cnt - polyhedron->vertex_cnt + 2; // https://en.wikipedia.org/wiki/Euler%27s_polyhedron_formula
unsigned n_verts_per_face = polyhedron->n_vertices / n_faces;
@@ -631,12 +631,12 @@ static void plato_destroy_context(void *context)
}
-static void plato_render_fragment(void *context, unsigned ticks, unsigned cpu, fb_fragment_t *fragment)
+static void plato_render_fragment(void *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment)
{
plato_context_t *ctxt = context;
ctxt->r += .015f;
- fb_fragment_zero(fragment);
+ til_fb_fragment_zero(fragment);
for (int i = 0; i < sizeof(polyhedra) / sizeof(*polyhedra); i++) {
m4f_t transform;
@@ -667,7 +667,7 @@ static void plato_render_fragment(void *context, unsigned ticks, unsigned cpu, f
}
-rototiller_module_t plato_module = {
+til_module_t plato_module = {
.create_context = plato_create_context,
.destroy_context = plato_destroy_context,
.render_fragment = plato_render_fragment,
diff --git a/src/modules/ray/ray.c b/src/modules/ray/ray.c
index 636e834..07e1f99 100644
--- a/src/modules/ray/ray.c
+++ b/src/modules/ray/ray.c
@@ -2,9 +2,9 @@
#include <inttypes.h>
#include <math.h>
-#include "fb.h"
-#include "rototiller.h"
-#include "util.h"
+#include "til.h"
+#include "til_fb.h"
+#include "til_util.h"
#include "ray/ray_camera.h"
#include "ray/ray_object.h"
@@ -142,14 +142,14 @@ static void ray_destroy_context(void *context)
}
-static int ray_fragmenter(void *context, const fb_fragment_t *fragment, unsigned number, fb_fragment_t *res_fragment)
+static int ray_fragmenter(void *context, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment)
{
- return fb_fragment_tile_single(fragment, 64, number, res_fragment);
+ return til_fb_fragment_tile_single(fragment, 64, number, res_fragment);
}
/* prepare a frame for concurrent rendering */
-static void ray_prepare_frame(void *context, unsigned ticks, unsigned n_cpus, fb_fragment_t *fragment, rototiller_fragmenter_t *res_fragmenter)
+static void ray_prepare_frame(void *context, unsigned ticks, unsigned n_cpus, til_fb_fragment_t *fragment, til_fragmenter_t *res_fragmenter)
{
ray_context_t *ctxt = context;
@@ -181,7 +181,7 @@ static void ray_prepare_frame(void *context, unsigned ticks, unsigned n_cpus, fb
/* ray trace a simple scene into the fragment */
-static void ray_render_fragment(void *context, unsigned ticks, unsigned cpu, fb_fragment_t *fragment)
+static void ray_render_fragment(void *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment)
{
ray_context_t *ctxt = context;
@@ -189,7 +189,7 @@ static void ray_render_fragment(void *context, unsigned ticks, unsigned cpu, fb_
}
-static void ray_finish_frame(void *context, unsigned ticks, fb_fragment_t *fragment)
+static void ray_finish_frame(void *context, unsigned ticks, til_fb_fragment_t *fragment)
{
ray_context_t *ctxt = context;
@@ -197,7 +197,7 @@ static void ray_finish_frame(void *context, unsigned ticks, fb_fragment_t *fragm
}
-rototiller_module_t ray_module = {
+til_module_t ray_module = {
.create_context = ray_create_context,
.destroy_context = ray_destroy_context,
.prepare_frame = ray_prepare_frame,
diff --git a/src/modules/roto/roto.c b/src/modules/roto/roto.c
index c72301b..0ccb1e2 100644
--- a/src/modules/roto/roto.c
+++ b/src/modules/roto/roto.c
@@ -3,8 +3,8 @@
#include <math.h>
#include <stdlib.h>
-#include "fb.h"
-#include "rototiller.h"
+#include "til.h"
+#include "til_fb.h"
/* Copyright (C) 2016 Vito Caputo <vcaputo@pengaru.com> */
@@ -169,16 +169,16 @@ static void init_roto(uint8_t texture[256][256], int32_t *costab, int32_t *sinta
}
-static int roto_fragmenter(void *context, const fb_fragment_t *fragment, unsigned number, fb_fragment_t *res_fragment)
+static int roto_fragmenter(void *context, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment)
{
roto_context_t *ctxt = context;
- return fb_fragment_slice_single(fragment, ctxt->n_cpus, number, res_fragment);
+ return til_fb_fragment_slice_single(fragment, ctxt->n_cpus, number, res_fragment);
}
/* prepare a frame for concurrent rendering */
-static void roto_prepare_frame(void *context, unsigned ticks, unsigned n_cpus, fb_fragment_t *fragment, rototiller_fragmenter_t *res_fragmenter)
+static void roto_prepare_frame(void *context, unsigned ticks, unsigned n_cpus, til_fb_fragment_t *fragment, til_fragmenter_t *res_fragmenter)
{
roto_context_t *ctxt = context;
static int initialized;
@@ -199,7 +199,7 @@ static void roto_prepare_frame(void *context, unsigned ticks, unsigned n_cpus, f
/* Draw a rotating checkered 256x256 texture into fragment. */
-static void roto_render_fragment(void *context, unsigned ticks, unsigned cpu, fb_fragment_t *fragment)
+static void roto_render_fragment(void *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment)
{
roto_context_t *ctxt = context;
int y_cos_r, y_sin_r, x_cos_r, x_sin_r, x_cos_r_init, x_sin_r_init, cos_r, sin_r;
@@ -248,7 +248,7 @@ static void roto_render_fragment(void *context, unsigned ticks, unsigned cpu, fb
}
-rototiller_module_t roto_module = {
+til_module_t roto_module = {
.create_context = roto_create_context,
.destroy_context = roto_destroy_context,
.prepare_frame = roto_prepare_frame,
diff --git a/src/modules/rtv/rtv.c b/src/modules/rtv/rtv.c
index 7731603..a517e8c 100644
--- a/src/modules/rtv/rtv.c
+++ b/src/modules/rtv/rtv.c
@@ -1,11 +1,12 @@
#include <stdlib.h>
#include <time.h>
-#include "fb.h"
-#include "rototiller.h"
-#include "settings.h"
+#include "til.h"
+#include "til_fb.h"
+#include "til_settings.h"
+#include "til_util.h"
+
#include "txt/txt.h"
-#include "util.h"
/* Copyright (C) 2019 - Vito Caputo <vcaputo@pengaru.com> */
@@ -21,33 +22,33 @@
#define RTV_CONTEXT_DURATION_SECS 60
typedef struct rtv_channel_t {
- const rototiller_module_t *module;
- void *module_ctxt;
- time_t last_on_time, cumulative_time;
- char *settings;
- txt_t *caption;
- unsigned order;
+ const til_module_t *module;
+ void *module_ctxt;
+ time_t last_on_time, cumulative_time;
+ char *settings;
+ txt_t *caption;
+ unsigned order;
} rtv_channel_t;
typedef struct rtv_context_t {
- unsigned n_cpus;
+ unsigned n_cpus;
- time_t next_switch, next_hide_caption;
- rtv_channel_t *channel, *last_channel;
- txt_t *caption;
+ time_t next_switch, next_hide_caption;
+ rtv_channel_t *channel, *last_channel;
+ txt_t *caption;
- rtv_channel_t snow_channel;
+ rtv_channel_t snow_channel;
- size_t n_channels;
- rtv_channel_t channels[];
+ size_t n_channels;
+ rtv_channel_t channels[];
} rtv_context_t;
static void setup_next_channel(rtv_context_t *ctxt, unsigned ticks);
static void * rtv_create_context(unsigned ticks, unsigned num_cpus);
static void rtv_destroy_context(void *context);
-static void rtv_prepare_frame(void *context, unsigned ticks, unsigned n_cpus, fb_fragment_t *fragment, rototiller_fragmenter_t *res_fragmenter);
-static void rtv_finish_frame(void *context, unsigned ticks, fb_fragment_t *fragment);
-static int rtv_setup(const settings_t *settings, setting_desc_t **next_setting);
+static void rtv_prepare_frame(void *context, unsigned ticks, unsigned n_cpus, til_fb_fragment_t *fragment, til_fragmenter_t *res_fragmenter);
+static void rtv_finish_frame(void *context, unsigned ticks, til_fb_fragment_t *fragment);
+static int rtv_setup(const til_settings_t *settings, til_setting_desc_t **next_setting);
static unsigned rtv_duration = RTV_DURATION_SECS;
static unsigned rtv_context_duration = RTV_CONTEXT_DURATION_SECS;
@@ -57,7 +58,7 @@ static char **rtv_channels;
static char *rtv_snow_module;
-rototiller_module_t rtv_module = {
+til_module_t rtv_module = {
.create_context = rtv_create_context,
.destroy_context = rtv_destroy_context,
.prepare_frame = rtv_prepare_frame,
@@ -91,16 +92,16 @@ static void randomize_channels(rtv_context_t *ctxt)
}
-static char * randomize_module_setup(const rototiller_module_t *module)
+static char * randomize_module_setup(const til_module_t *module)
{
- settings_t *settings;
- setting_desc_t *desc;
- char *arg;
+ til_settings_t *settings;
+ til_setting_desc_t *desc;
+ char *arg;
if (!module->setup)
return NULL;
- settings = settings_new(NULL);
+ settings = til_settings_new(NULL);
if (!settings)
return NULL;
@@ -109,7 +110,7 @@ static char * randomize_module_setup(const rototiller_module_t *module)
char *value;
value = desc->random();
- settings_add_value(settings, desc->key, value);
+ til_settings_add_value(settings, desc->key, value);
free(value);
} else if (desc->values) {
int n;
@@ -118,16 +119,16 @@ static char * randomize_module_setup(const rototiller_module_t *module)
n = rand() % n;
- settings_add_value(settings, desc->key, desc->values[n]);
+ til_settings_add_value(settings, desc->key, desc->values[n]);
} else {
- settings_add_value(settings, desc->key, desc->preferred);
+ til_settings_add_value(settings, desc->key, desc->preferred);
}
- setting_desc_free(desc);
+ til_setting_desc_free(desc);
}
- arg = settings_as_arg(settings);
- settings_free(settings);
+ arg = til_settings_as_arg(settings);
+ til_settings_free(settings);
return arg;
}
@@ -209,7 +210,7 @@ static void setup_next_channel(rtv_context_t *ctxt, unsigned ticks)
}
-static int rtv_should_skip_module(const rtv_context_t *ctxt, const rototiller_module_t *module)
+static int rtv_should_skip_module(const rtv_context_t *ctxt, const til_module_t *module)
{
if (module == &rtv_module ||
module == ctxt->snow_channel.module)
@@ -229,12 +230,12 @@ static int rtv_should_skip_module(const rtv_context_t *ctxt, const rototiller_mo
static void * rtv_create_context(unsigned ticks, unsigned num_cpus)
{
- rtv_context_t *ctxt;
- const rototiller_module_t **modules;
- size_t n_modules;
- static rototiller_module_t none_module = {};
+ rtv_context_t *ctxt;
+ const til_module_t **modules;
+ size_t n_modules;
+ static til_module_t none_module = {};
- rototiller_get_modules(&modules, &n_modules);
+ til_get_modules(&modules, &n_modules);
ctxt = calloc(1, sizeof(rtv_context_t) + n_modules * sizeof(rtv_channel_t));
if (!ctxt)
@@ -244,7 +245,7 @@ static void * rtv_create_context(unsigned ticks, unsigned num_cpus)
ctxt->snow_channel.module = &none_module;
if (rtv_snow_module) {
- ctxt->snow_channel.module = rototiller_lookup_module(rtv_snow_module);
+ ctxt->snow_channel.module = til_lookup_module(rtv_snow_module);
if (ctxt->snow_channel.module->create_context)
ctxt->snow_channel.module_ctxt = ctxt->snow_channel.module->create_context(ticks, ctxt->n_cpus);
}
@@ -268,7 +269,7 @@ static void rtv_destroy_context(void *context)
}
-static void rtv_prepare_frame(void *context, unsigned ticks, unsigned n_cpus, fb_fragment_t *fragment, rototiller_fragmenter_t *res_fragmenter)
+static void rtv_prepare_frame(void *context, unsigned ticks, unsigned n_cpus, til_fb_fragment_t *fragment, til_fragmenter_t *res_fragmenter)
{
rtv_context_t *ctxt = context;
time_t now = time(NULL);
@@ -284,13 +285,13 @@ static void rtv_prepare_frame(void *context, unsigned ticks, unsigned n_cpus, fb
*/
if (!ctxt->channel->module->render_fragment &&
!ctxt->channel->module->prepare_frame)
- fb_fragment_zero(fragment);
+ til_fb_fragment_zero(fragment);
else
- rototiller_module_render(ctxt->channel->module, ctxt->channel->module_ctxt, ticks, fragment);
+ til_module_render(ctxt->channel->module, ctxt->channel->module_ctxt, ticks, fragment);
}
-static void rtv_finish_frame(void *context, unsigned ticks, fb_fragment_t *fragment)
+static void rtv_finish_frame(void *context, unsigned ticks, til_fb_fragment_t *fragment)
{
rtv_context_t *ctxt = context;
@@ -312,7 +313,7 @@ static void rtv_finish_frame(void *context, unsigned ticks, fb_fragment_t *fragm
}
-static int rtv_setup(const settings_t *settings, setting_desc_t **next_setting)
+static int rtv_setup(const til_settings_t *settings, til_setting_desc_t **next_setting)
{
const char *duration;
const char *context_duration;
@@ -321,11 +322,11 @@ static int rtv_setup(const settings_t *settings, setting_desc_t **next_setting)
const char *channels;
const char *snow_module;
- channels = settings_get_value(settings, "channels");
+ channels = til_settings_get_value(settings, "channels");
if (!channels) {
int r;
- r = setting_desc_clone(&(setting_desc_t){
+ r = til_setting_desc_clone(&(til_setting_desc_t){
.name = "Colon-Separated List Of Channel Modules",
.key = "channels",
.preferred = "all",
@@ -337,15 +338,15 @@ static int rtv_setup(const settings_t *settings, setting_desc_t **next_setting)
return 1;
}
- duration = settings_get_value(settings, "duration");
+ duration = til_settings_get_value(settings, "duration");
if (!duration) {
int r;
- r = setting_desc_clone(&(setting_desc_t){
+ r = til_setting_desc_clone(&(til_setting_desc_t){
.name = "Channel Duration In Seconds",
.key = "duration",
.regex = "\\.[0-9]+",
- .preferred = SETTINGS_STR(RTV_DURATION_SECS),
+ .preferred = TIL_SETTINGS_STR(RTV_DURATION_SECS),
.annotations = NULL
}, next_setting);
if (r < 0)
@@ -354,15 +355,15 @@ static int rtv_setup(const settings_t *settings, setting_desc_t **next_setting)
return 1;
}
- context_duration = settings_get_value(settings, "context_duration");
+ context_duration = til_settings_get_value(settings, "context_duration");
if (!context_duration) {
int r;
- r = setting_desc_clone(&(setting_desc_t){
+ r = til_setting_desc_clone(&(til_setting_desc_t){
.name = "Context Duration In Seconds",
.key = "context_duration",
.regex = "\\.[0-9]+",
- .preferred = SETTINGS_STR(RTV_CONTEXT_DURATION_SECS),
+ .preferred = TIL_SETTINGS_STR(RTV_CONTEXT_DURATION_SECS),
.annotations = NULL
}, next_setting);
if (r < 0)
@@ -371,15 +372,15 @@ static int rtv_setup(const settings_t *settings, setting_desc_t **next_setting)
return 1;
}
- caption_duration = settings_get_value(settings, "caption_duration");
+ caption_duration = til_settings_get_value(settings, "caption_duration");
if (!caption_duration) {
int r;
- r = setting_desc_clone(&(setting_desc_t){
+ r = til_setting_desc_clone(&(til_setting_desc_t){
.name = "Caption Duration In Seconds",
.key = "caption_duration",
.regex = "\\.[0-9]+",
- .preferred = SETTINGS_STR(RTV_CAPTION_DURATION_SECS),
+ .preferred = TIL_SETTINGS_STR(RTV_CAPTION_DURATION_SECS),
.annotations = NULL
}, next_setting);
if (r < 0)
@@ -388,15 +389,15 @@ static int rtv_setup(const settings_t *settings, setting_desc_t **next_setting)
return 1;
}
- snow_duration = settings_get_value(settings, "snow_duration");
+ snow_duration = til_settings_get_value(settings, "snow_duration");
if (!snow_duration) {
int r;
- r = setting_desc_clone(&(setting_desc_t){
+ r = til_setting_desc_clone(&(til_setting_desc_t){
.name = "Snow On Channel Switch Duration In Seconds",
.key = "snow_duration",
.regex = "\\.[0-9]+",
- .preferred = SETTINGS_STR(RTV_SNOW_DURATION_SECS),
+ .preferred = TIL_SETTINGS_STR(RTV_SNOW_DURATION_SECS),
.annotations = NULL
}, next_setting);
if (r < 0)
@@ -405,11 +406,11 @@ static int rtv_setup(const settings_t *settings, setting_desc_t **next_setting)
return 1;
}
- snow_module = settings_get_value(settings, "snow_module");
+ snow_module = til_settings_get_value(settings, "snow_module");
if (!snow_module) {
int r;
- r = setting_desc_clone(&(setting_desc_t){
+ r = til_setting_desc_clone(&(til_setting_desc_t){
.name = "Module To Use For Snow (\"none\" To Blank)",
.key = "snow_module",
.preferred = "snow",
@@ -423,12 +424,12 @@ static int rtv_setup(const settings_t *settings, setting_desc_t **next_setting)
/* turn channels colon-separated list into a null-terminated array of strings */
if (strcmp(channels, "all")) {
- const rototiller_module_t **modules;
- size_t n_modules;
- char *tokchannels, *channel;
- int n = 2;
+ const til_module_t **modules;
+ size_t n_modules;
+ char *tokchannels, *channel;
+ int n = 2;
- rototiller_get_modules(&modules, &n_modules);
+ til_get_modules(&modules, &n_modules);
tokchannels = strdup(channels);
if (!tokchannels)
diff --git a/src/modules/snow/snow.c b/src/modules/snow/snow.c
index d1f3758..5c753b9 100644
--- a/src/modules/snow/snow.c
+++ b/src/modules/snow/snow.c
@@ -2,8 +2,8 @@
#include <stdlib.h>
#include <time.h>
-#include "fb.h"
-#include "rototiller.h"
+#include "til.h"
+#include "til_fb.h"
/* Copyright (C) 2019 - Vito Caputo <vcaputo@pengaru.com> */
@@ -43,21 +43,21 @@ static void snow_destroy_context(void *context)
}
-static int snow_fragmenter(void *context, const fb_fragment_t *fragment, unsigned number, fb_fragment_t *res_fragment)
+static int snow_fragmenter(void *context, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment)
{
snow_context_t *ctxt = context;
- return fb_fragment_slice_single(fragment, ctxt->n_cpus, number, res_fragment);
+ return til_fb_fragment_slice_single(fragment, ctxt->n_cpus, number, res_fragment);
}
-static void snow_prepare_frame(void *context, unsigned ticks, unsigned n_cpus, fb_fragment_t *fragment, rototiller_fragmenter_t *res_fragmenter)
+static void snow_prepare_frame(void *context, unsigned ticks, unsigned n_cpus, til_fb_fragment_t *fragment, til_fragmenter_t *res_fragmenter)
{
*res_fragmenter = snow_fragmenter;
}
-static void snow_render_fragment(void *context, unsigned ticks, unsigned cpu, fb_fragment_t *fragment)
+static void snow_render_fragment(void *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment)
{
snow_context_t *ctxt = context;
int *seed = &ctxt->seeds[cpu].seed;
@@ -70,13 +70,13 @@ static void snow_render_fragment(void *context, unsigned ticks, unsigned cpu, fb
uint32_t pixel = rand_r(seed) % 256;
#endif
- fb_fragment_put_pixel_unchecked(fragment, x, y, pixel << 16 | pixel << 8 | pixel);
+ til_fb_fragment_put_pixel_unchecked(fragment, x, y, pixel << 16 | pixel << 8 | pixel);
}
}
}
-rototiller_module_t snow_module = {
+til_module_t snow_module = {
.create_context = snow_create_context,
.destroy_context = snow_destroy_context,
.prepare_frame = snow_prepare_frame,
diff --git a/src/modules/sparkler/burst.c b/src/modules/sparkler/burst.c
index b5ad365..cf35b31 100644
--- a/src/modules/sparkler/burst.c
+++ b/src/modules/sparkler/burst.c
@@ -43,13 +43,13 @@ static inline void thrust_part(particle_t *burst, particle_t *victim, float dist
typedef struct burst_sphere_t {
- particles_t *particles;
- particle_t *center, *last;
- fb_fragment_t *fragment;
- float radius_min;
- float radius_max;
- unsigned trace_matches:1;
- unsigned trace_affected:1;
+ particles_t *particles;
+ particle_t *center, *last;
+ til_fb_fragment_t *fragment;
+ float radius_min;
+ float radius_max;
+ unsigned trace_matches:1;
+ unsigned trace_affected:1;
} burst_sphere_t;
@@ -94,7 +94,7 @@ static void burst_cb(bsp_t *bsp, list_head_t *occupants, void *_s)
}
-static particle_status_t burst_sim(particles_t *particles, const particles_conf_t *conf, particle_t *p, fb_fragment_t *f)
+static particle_status_t burst_sim(particles_t *particles, const particles_conf_t *conf, particle_t *p, til_fb_fragment_t *f)
{
burst_ctxt_t *ctxt = p->ctxt;
bsp_t *bsp = particles_bsp(particles); /* XXX see note above about bsp_occupant_t */
diff --git a/src/modules/sparkler/helpers.h b/src/modules/sparkler/helpers.h
index 3fd1bda..4c2497e 100644
--- a/src/modules/sparkler/helpers.h
+++ b/src/modules/sparkler/helpers.h
@@ -3,7 +3,8 @@
#include <stdint.h>
-#include "fb.h"
+#include "til_fb.h"
+
#include "particle.h"
#include "particles.h"
@@ -20,9 +21,9 @@ static inline uint32_t makergb(uint32_t r, uint32_t g, uint32_t b, float intensi
/* return if the particle should be drawn, and set *longevity to 0 if out of bounds */
-static inline int should_draw_expire_if_oob(particles_t *particles, particle_t *p, int x, int y, fb_fragment_t *f, int *longevity)
+static inline int should_draw_expire_if_oob(particles_t *particles, particle_t *p, int x, int y, til_fb_fragment_t *f, int *longevity)
{
- if (!fb_fragment_contains(f, x, y)) {
+ if (!til_fb_fragment_contains(f, x, y)) {
if (longevity && (x < 0 || x > f->frame_width || y < 0 || y > f->frame_height))
*longevity = 0; /* offscreen */
diff --git a/src/modules/sparkler/particle.h b/src/modules/sparkler/particle.h
index a5999ee..6a5bf73 100644
--- a/src/modules/sparkler/particle.h
+++ b/src/modules/sparkler/particle.h
@@ -1,8 +1,9 @@
#ifndef _PARTICLE_H
#define _PARTICLE_H
+#include "til_fb.h"
+
#include "bsp.h"
-#include "fb.h"
#include "v3f.h"
typedef struct particle_props_t {
@@ -28,8 +29,8 @@ typedef struct particle_ops_t {
unsigned context_size; /* size of the particle context (0 for none) */
int (*init)(particles_t *, const particles_conf_t *, particle_t *); /* initialize the particle, called after allocating context (optional) */
void (*cleanup)(particles_t *, const particles_conf_t *, particle_t *); /* cleanup function, called before freeing context (optional) */
- particle_status_t (*sim)(particles_t *, const particles_conf_t *, particle_t *, fb_fragment_t *); /* simulate the particle for another cycle (required) */
- void (*draw)(particles_t *, const particles_conf_t *, particle_t *, int, int, fb_fragment_t *); /* draw the particle, 3d->2d projection has been done already (optional) */
+ particle_status_t (*sim)(particles_t *, const particles_conf_t *, particle_t *, til_fb_fragment_t *); /* simulate the particle for another cycle (required) */
+ void (*draw)(particles_t *, const particles_conf_t *, particle_t *, int, int, til_fb_fragment_t *); /* draw the particle, 3d->2d projection has been done already (optional) */
} particle_ops_t;
struct particle_t {
@@ -68,12 +69,12 @@ static inline void particle_cleanup(particles_t *particles, const particles_conf
* example is true, then sim may draw into fragment, and the callers shouldn't zero the fragment between sim and draw but
* instead should zero it before sim. It's kind of janky, not a fan.
*/
-static inline particle_status_t particle_sim(particles_t *particles, const particles_conf_t *conf, particle_t *p, fb_fragment_t *f) {
+static inline particle_status_t particle_sim(particles_t *particles, const particles_conf_t *conf, particle_t *p, til_fb_fragment_t *f) {
return p->ops->sim(particles, conf, p, f);
}
-static inline void particle_draw(particles_t *particles, const particles_conf_t *conf, particle_t *p, int x, int y, fb_fragment_t *f) {
+static inline void particle_draw(particles_t *particles, const particles_conf_t *conf, particle_t *p, int x, int y, til_fb_fragment_t *f) {
if (p->ops->draw) {
p->ops->draw(particles, conf, p, x, y, f);
}
diff --git a/src/modules/sparkler/particles.c b/src/modules/sparkler/particles.c
index d4677b7..a567cea 100644
--- a/src/modules/sparkler/particles.c
+++ b/src/modules/sparkler/particles.c
@@ -7,7 +7,7 @@
#include <stdlib.h>
#include <time.h>
-#include "fb.h"
+#include "til_fb.h"
#include "chunker.h"
#include "container.h"
@@ -221,7 +221,7 @@ bsp_t * particles_bsp(particles_t *particles)
}
-static inline void _particles_draw(particles_t *particles, list_head_t *list, fb_fragment_t *fragment)
+static inline void _particles_draw(particles_t *particles, list_head_t *list, til_fb_fragment_t *fragment)
{
float w2 = fragment->frame_width * .5f, h2 = fragment->frame_height * .5f;
_particle_t *p;
@@ -247,7 +247,7 @@ static inline void _particles_draw(particles_t *particles, list_head_t *list, fb
/* TODO: maybe polish up and move into fb.c? */
-static void draw_line(fb_fragment_t *fragment, int x1, int y1, int x2, int y2)
+static void draw_line(til_fb_fragment_t *fragment, int x1, int y1, int x2, int y2)
{
int x_delta = x2 - x1;
int y_delta = y2 - y1;
@@ -265,7 +265,7 @@ static void draw_line(fb_fragment_t *fragment, int x1, int y1, int x2, int y2)
minor -= x_delta;
}
- fb_fragment_put_pixel_checked(fragment, x1, y1, 0xffffffff);
+ til_fb_fragment_put_pixel_checked(fragment, x1, y1, 0xffffffff);
}
} else {
/* Y-major */
@@ -275,13 +275,13 @@ static void draw_line(fb_fragment_t *fragment, int x1, int y1, int x2, int y2)
minor -= y_delta;
}
- fb_fragment_put_pixel_checked(fragment, x1, y1, 0xffffffff);
+ til_fb_fragment_put_pixel_checked(fragment, x1, y1, 0xffffffff);
}
}
}
-static void draw_edge(fb_fragment_t *fragment, const v3f_t *a, const v3f_t *b)
+static void draw_edge(til_fb_fragment_t *fragment, const v3f_t *a, const v3f_t *b)
{
float w2 = fragment->frame_width * .5f, h2 = fragment->frame_height * .5f;
int x1, y1, x2, y2;
@@ -296,7 +296,7 @@ static void draw_edge(fb_fragment_t *fragment, const v3f_t *a, const v3f_t *b)
}
-static void draw_bv(fb_fragment_t *fragment, const v3f_t *bv_min, const v3f_t *bv_max)
+static void draw_bv(til_fb_fragment_t *fragment, const v3f_t *bv_min, const v3f_t *bv_max)
{
draw_edge(fragment,
&(v3f_t){bv_min->x, bv_max->y, bv_min->z},
@@ -339,8 +339,8 @@ static void draw_bv(fb_fragment_t *fragment, const v3f_t *bv_min, const v3f_t *b
/* something to encapsulate these pointers for passing through as one to draw_leaf() */
typedef struct draw_leafs_t {
- particles_t *particles;
- fb_fragment_t *fragment;
+ particles_t *particles;
+ til_fb_fragment_t *fragment;
} draw_leafs_t;
@@ -360,7 +360,7 @@ static void draw_leaf(const bsp_t *bsp, const list_head_t *occupants, unsigned d
/* draw all of the particles, currently called in heirarchical order */
-void particles_draw(particles_t *particles, fb_fragment_t *fragment)
+void particles_draw(particles_t *particles, til_fb_fragment_t *fragment)
{
draw_leafs_t draw = { .particles = particles, .fragment = fragment };
@@ -373,7 +373,7 @@ void particles_draw(particles_t *particles, fb_fragment_t *fragment)
}
-static inline particle_status_t _particles_sim(particles_t *particles, list_head_t *list, fb_fragment_t *fragment)
+static inline particle_status_t _particles_sim(particles_t *particles, list_head_t *list, til_fb_fragment_t *fragment)
{
particle_status_t ret = PARTICLE_DEAD, s;
_particle_t *p, *_p;
@@ -400,7 +400,7 @@ static inline particle_status_t _particles_sim(particles_t *particles, list_head
/* simulate the particles, call the sim method of every particle in the heirarchy, this is what makes the particles dynamic */
/* if any paticle is still living, we return PARTICLE_ALIVE, to inform the caller when everything's dead */
-particle_status_t particles_sim(particles_t *particles, fb_fragment_t *fragment)
+particle_status_t particles_sim(particles_t *particles, til_fb_fragment_t *fragment)
{
assert(particles);
@@ -480,7 +480,7 @@ void particles_age(particles_t *particles)
/* draw a line expressed in world-space positions a to b into fragment, this is intended for
* instrumentation/overlay debugging type purposes...
*/
-void particles_draw_line(particles_t *particles, const v3f_t *a, const v3f_t *b, fb_fragment_t *fragment)
+void particles_draw_line(particles_t *particles, const v3f_t *a, const v3f_t *b, til_fb_fragment_t *fragment)
{
float w2 = fragment->frame_width * .5f, h2 = fragment->frame_height * .5f;
int x1, y1, x2, y2;
diff --git a/src/modules/sparkler/particles.h b/src/modules/sparkler/particles.h
index 9d6e3af..1cb737f 100644
--- a/src/modules/sparkler/particles.h
+++ b/src/modules/sparkler/particles.h
@@ -1,8 +1,9 @@
#ifndef _PARTICLES_H
#define _PARTICLES_H
+#include "til_fb.h"
+
#include "bsp.h"
-#include "fb.h"
#include "list.h"
#include "particle.h"
@@ -17,14 +18,14 @@ typedef struct particles_t particles_t;
typedef struct v3f_t v3f_t;
particles_t * particles_new(const particles_conf_t *conf);
-void particles_draw(particles_t *particles, fb_fragment_t *fragment);
-particle_status_t particles_sim(particles_t *particles, fb_fragment_t *fragment);
+void particles_draw(particles_t *particles, til_fb_fragment_t *fragment);
+particle_status_t particles_sim(particles_t *particles, til_fb_fragment_t *fragment);
void particles_age(particles_t *particles);
void particles_free(particles_t *particles);
int particles_add_particle(particles_t *particles, particle_props_t *props, particle_ops_t *ops);
void particles_spawn_particle(particles_t *particles, particle_t *parent, particle_props_t *props, particle_ops_t *ops);
void particles_add_particles(particles_t *particles, particle_props_t *props, particle_ops_t *ops, int num);
bsp_t * particles_bsp(particles_t *particles);
-void particles_draw_line(particles_t *particles, const v3f_t *a, const v3f_t *b, fb_fragment_t *fragment);
+void particles_draw_line(particles_t *particles, const v3f_t *a, const v3f_t *b, til_fb_fragment_t *fragment);
#endif
diff --git a/src/modules/sparkler/rocket.c b/src/modules/sparkler/rocket.c
index 50e1ff5..3885304 100644
--- a/src/modules/sparkler/rocket.c
+++ b/src/modules/sparkler/rocket.c
@@ -1,6 +1,7 @@
#include <stdlib.h>
-#include "fb.h"
+#include "til_fb.h"
+
#include "helpers.h"
#include "particle.h"
#include "particles.h"
@@ -54,7 +55,7 @@ static int rocket_init(particles_t *particles, const particles_conf_t *conf, par
}
-static particle_status_t rocket_sim(particles_t *particles, const particles_conf_t *conf, particle_t *p, fb_fragment_t *f)
+static particle_status_t rocket_sim(particles_t *particles, const particles_conf_t *conf, particle_t *p, til_fb_fragment_t *f)
{
rocket_ctxt_t *ctxt = p->ctxt;
int i, n_sparks;
@@ -120,7 +121,7 @@ static particle_status_t rocket_sim(particles_t *particles, const particles_conf
}
-static void rocket_draw(particles_t *particles, const particles_conf_t *conf, particle_t *p, int x, int y, fb_fragment_t *f)
+static void rocket_draw(particles_t *particles, const particles_conf_t *conf, particle_t *p, int x, int y, til_fb_fragment_t *f)
{
rocket_ctxt_t *ctxt = p->ctxt;
@@ -128,7 +129,7 @@ static void rocket_draw(particles_t *particles, const particles_conf_t *conf, pa
/* kill off parts that wander off screen */
return;
- fb_fragment_put_pixel_unchecked(f, x, y, 0xff0000);
+ til_fb_fragment_put_pixel_unchecked(f, x, y, 0xff0000);
}
diff --git a/src/modules/sparkler/simple.c b/src/modules/sparkler/simple.c
index 8db15b1..14c5d49 100644
--- a/src/modules/sparkler/simple.c
+++ b/src/modules/sparkler/simple.c
@@ -1,6 +1,7 @@
#include <stdlib.h>
-#include "fb.h"
+#include "til_fb.h"
+
#include "helpers.h"
#include "particle.h"
#include "particles.h"
@@ -54,7 +55,7 @@ static int simple_init(particles_t *particles, const particles_conf_t *conf, par
}
-static particle_status_t simple_sim(particles_t *particles, const particles_conf_t *conf, particle_t *p, fb_fragment_t *f)
+static particle_status_t simple_sim(particles_t *particles, const particles_conf_t *conf, particle_t *p, til_fb_fragment_t *f)
{
simple_ctxt_t *ctxt = p->ctxt;
@@ -95,7 +96,7 @@ static particle_status_t simple_sim(particles_t *particles, const particles_conf
}
-static void simple_draw(particles_t *particles, const particles_conf_t *conf, particle_t *p, int x, int y, fb_fragment_t *f)
+static void simple_draw(particles_t *particles, const particles_conf_t *conf, particle_t *p, int x, int y, til_fb_fragment_t *f)
{
simple_ctxt_t *ctxt = p->ctxt;
@@ -103,7 +104,7 @@ static void simple_draw(particles_t *particles, const particles_conf_t *conf, pa
/* immediately kill off stars that wander off screen */
return;
- fb_fragment_put_pixel_unchecked(f, x, y, makergb(0xff, 0xff, 0xff, ((float)ctxt->longevity / ctxt->lifetime)));
+ til_fb_fragment_put_pixel_unchecked(f, x, y, makergb(0xff, 0xff, 0xff, ((float)ctxt->longevity / ctxt->lifetime)));
}
diff --git a/src/modules/sparkler/spark.c b/src/modules/sparkler/spark.c
index c432bf5..8eff728 100644
--- a/src/modules/sparkler/spark.c
+++ b/src/modules/sparkler/spark.c
@@ -1,6 +1,7 @@
#include <stdlib.h>
-#include "fb.h"
+#include "til_fb.h"
+
#include "helpers.h"
#include "particle.h"
#include "particles.h"
@@ -32,7 +33,7 @@ static int spark_init(particles_t *particles, const particles_conf_t *conf, part
}
-static particle_status_t spark_sim(particles_t *particles, const particles_conf_t *conf, particle_t *p, fb_fragment_t *f)
+static particle_status_t spark_sim(particles_t *particles, const particles_conf_t *conf, particle_t *p, til_fb_fragment_t *f)
{
spark_ctxt_t *ctxt = p->ctxt;
@@ -45,7 +46,7 @@ static particle_status_t spark_sim(particles_t *particles, const particles_conf_
}
-static void spark_draw(particles_t *particles, const particles_conf_t *conf, particle_t *p, int x, int y, fb_fragment_t *f)
+static void spark_draw(particles_t *particles, const particles_conf_t *conf, particle_t *p, int x, int y, til_fb_fragment_t *f)
{
spark_ctxt_t *ctxt = p->ctxt;
@@ -53,7 +54,7 @@ static void spark_draw(particles_t *particles, const particles_conf_t *conf, par
/* offscreen */
return;
- fb_fragment_put_pixel_unchecked(f, x, y, makergb(0xff, 0xa0, 0x20, ((float)ctxt->longevity / ctxt->lifetime)));
+ til_fb_fragment_put_pixel_unchecked(f, x, y, makergb(0xff, 0xa0, 0x20, ((float)ctxt->longevity / ctxt->lifetime)));
}
diff --git a/src/modules/sparkler/sparkler.c b/src/modules/sparkler/sparkler.c
index b673d0c..8b8681f 100644
--- a/src/modules/sparkler/sparkler.c
+++ b/src/modules/sparkler/sparkler.c
@@ -4,9 +4,9 @@
#include <time.h>
#include <unistd.h>
-#include "fb.h"
-#include "rototiller.h"
-#include "util.h"
+#include "til.h"
+#include "til_fb.h"
+#include "til_util.h"
#include "particles.h"
@@ -60,14 +60,14 @@ static void sparkler_destroy_context(void *context)
}
-static int sparkler_fragmenter(void *context, const fb_fragment_t *fragment, unsigned number, fb_fragment_t *res_fragment)
+static int sparkler_fragmenter(void *context, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment)
{
sparkler_context_t *ctxt = context;
- return fb_fragment_slice_single(fragment, ctxt->n_cpus, number, res_fragment);
+ return til_fb_fragment_slice_single(fragment, ctxt->n_cpus, number, res_fragment);
}
-static void sparkler_prepare_frame(void *context, unsigned ticks, unsigned ncpus, fb_fragment_t *fragment, rototiller_fragmenter_t *res_fragmenter)
+static void sparkler_prepare_frame(void *context, unsigned ticks, unsigned ncpus, til_fb_fragment_t *fragment, til_fragmenter_t *res_fragmenter)
{
sparkler_context_t *ctxt = context;
@@ -75,7 +75,7 @@ static void sparkler_prepare_frame(void *context, unsigned ticks, unsigned ncpus
ctxt->n_cpus = ncpus;
if (sparkler_conf.show_bsp_matches)
- fb_fragment_zero(fragment);
+ til_fb_fragment_zero(fragment);
particles_sim(ctxt->particles, fragment);
particles_add_particles(ctxt->particles, NULL, &simple_ops, INIT_PARTS / 4);
@@ -84,19 +84,19 @@ static void sparkler_prepare_frame(void *context, unsigned ticks, unsigned ncpus
/* Render a 3D particle system */
-static void sparkler_render_fragment(void *context, unsigned ticks, unsigned cpu, fb_fragment_t *fragment)
+static void sparkler_render_fragment(void *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment)
{
sparkler_context_t *ctxt = context;
if (!sparkler_conf.show_bsp_matches)
- fb_fragment_zero(fragment);
+ til_fb_fragment_zero(fragment);
particles_draw(ctxt->particles, fragment);
}
/* Settings hooks for configurable variables */
-static int sparkler_setup(const settings_t *settings, setting_desc_t **next_setting)
+static int sparkler_setup(const til_settings_t *settings, til_setting_desc_t **next_setting)
{
const char *show_bsp_leafs;
const char *show_bsp_matches;
@@ -108,11 +108,11 @@ static int sparkler_setup(const settings_t *settings, setting_desc_t **next_sett
/* TODO: return -EINVAL on parse errors? */
- show_bsp_leafs = settings_get_value(settings, "show_bsp_leafs");
+ show_bsp_leafs = til_settings_get_value(settings, "show_bsp_leafs");
if (!show_bsp_leafs) {
int r;
- r = setting_desc_clone(&(setting_desc_t){
+ r = til_setting_desc_clone(&(til_setting_desc_t){
.name = "Show BSP Leaf Node Bounding Boxes",
.key = "show_bsp_leafs",
.preferred = "off",
@@ -129,7 +129,7 @@ static int sparkler_setup(const settings_t *settings, setting_desc_t **next_sett
sparkler_conf.show_bsp_leafs = 1;
- show_bsp_leafs_min_depth = settings_get_value(settings, "show_bsp_leafs_min_depth");
+ show_bsp_leafs_min_depth = til_settings_get_value(settings, "show_bsp_leafs_min_depth");
if (!show_bsp_leafs_min_depth) {
const char *depth_values[] = {
"0",
@@ -141,7 +141,7 @@ static int sparkler_setup(const settings_t *settings, setting_desc_t **next_sett
};
int r;
- r = setting_desc_clone(&(setting_desc_t){
+ r = til_setting_desc_clone(&(til_setting_desc_t){
.name = "Show BSP Leaf Node Bounding Boxes Minimum Depth",
.key = "show_bsp_leafs_min_depth",
.preferred = "8",
@@ -158,11 +158,11 @@ static int sparkler_setup(const settings_t *settings, setting_desc_t **next_sett
sparkler_conf.show_bsp_leafs = 0;
}
- show_bsp_matches = settings_get_value(settings, "show_bsp_matches");
+ show_bsp_matches = til_settings_get_value(settings, "show_bsp_matches");
if (!show_bsp_matches) {
int r;
- r = setting_desc_clone(&(setting_desc_t){
+ r = til_setting_desc_clone(&(til_setting_desc_t){
.name = "Show BSP Search Matches",
.key = "show_bsp_matches",
.preferred = "off",
@@ -182,11 +182,11 @@ static int sparkler_setup(const settings_t *settings, setting_desc_t **next_sett
if (!strcasecmp(show_bsp_matches, "on")) {
const char *show_bsp_matches_affected_only;
- show_bsp_matches_affected_only = settings_get_value(settings, "show_bsp_matches_affected_only");
+ show_bsp_matches_affected_only = til_settings_get_value(settings, "show_bsp_matches_affected_only");
if (!show_bsp_matches_affected_only) {
int r;
- r = setting_desc_clone(&(setting_desc_t){
+ r = til_setting_desc_clone(&(til_setting_desc_t){
.name = "Show Only Affected BSP Search Matches",
.key = "show_bsp_matches_affected_only",
.preferred = "off",
@@ -208,7 +208,7 @@ static int sparkler_setup(const settings_t *settings, setting_desc_t **next_sett
}
-rototiller_module_t sparkler_module = {
+til_module_t sparkler_module = {
.create_context = sparkler_create_context,
.destroy_context = sparkler_destroy_context,
.prepare_frame = sparkler_prepare_frame,
diff --git a/src/modules/sparkler/xplode.c b/src/modules/sparkler/xplode.c
index 4d6ee36..931ec83 100644
--- a/src/modules/sparkler/xplode.c
+++ b/src/modules/sparkler/xplode.c
@@ -1,6 +1,7 @@
#include <stdlib.h>
-#include "fb.h"
+#include "til_fb.h"
+
#include "helpers.h"
#include "particle.h"
#include "particles.h"
@@ -36,7 +37,7 @@ static int xplode_init(particles_t *particles, const particles_conf_t *conf, par
}
-static particle_status_t xplode_sim(particles_t *particles, const particles_conf_t *conf, particle_t *p, fb_fragment_t *f)
+static particle_status_t xplode_sim(particles_t *particles, const particles_conf_t *conf, particle_t *p, til_fb_fragment_t *f)
{
xplode_ctxt_t *ctxt = p->ctxt;
@@ -57,7 +58,7 @@ static particle_status_t xplode_sim(particles_t *particles, const particles_conf
}
-static void xplode_draw(particles_t *particles, const particles_conf_t *conf, particle_t *p, int x, int y, fb_fragment_t *f)
+static void xplode_draw(particles_t *particles, const particles_conf_t *conf, particle_t *p, int x, int y, til_fb_fragment_t *f)
{
xplode_ctxt_t *ctxt = p->ctxt;
uint32_t color;
@@ -71,7 +72,7 @@ static void xplode_draw(particles_t *particles, const particles_conf_t *conf, pa
color = makergb(0xff, 0xff, 0x00, ((float)ctxt->longevity / ctxt->lifetime));
}
- fb_fragment_put_pixel_unchecked(f, x, y, color);
+ til_fb_fragment_put_pixel_unchecked(f, x, y, color);
}
diff --git a/src/modules/spiro/spiro.c b/src/modules/spiro/spiro.c
index 6f2af97..ca3086f 100644
--- a/src/modules/spiro/spiro.c
+++ b/src/modules/spiro/spiro.c
@@ -4,9 +4,10 @@
#include <time.h>
#include <unistd.h>
+#include "til.h"
+#include "til_fb.h"
+
#include "draw.h"
-#include "fb.h"
-#include "rototiller.h"
/* Copyright (C) 2020 Philip J. Freeman <elektron@halo.nu> */
@@ -60,7 +61,7 @@ static void spiro_destroy_context(void *context)
}
-static void spiro_render_fragment(void *context, unsigned ticks, unsigned cpu, fb_fragment_t *fragment)
+static void spiro_render_fragment(void *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment)
{
spiro_context_t *ctxt = context;
@@ -82,7 +83,7 @@ static void spiro_render_fragment(void *context, unsigned ticks, unsigned cpu, f
}
/* blank the fragment */
- fb_fragment_zero(fragment);
+ til_fb_fragment_zero(fragment);
/* plot one spirograph run */
float l=ctxt->p/ctxt->r;
@@ -92,7 +93,7 @@ static void spiro_render_fragment(void *context, unsigned ticks, unsigned cpu, f
float my_y=((1.f-k)*sinf(t))-(l*k*sinf(((1.f-k)/k)*t));
int pos_x=display_origin_x+(my_x*display_R);
int pos_y=display_origin_y+(my_y*display_R);
- fb_fragment_put_pixel_unchecked(fragment, pos_x, pos_y,
+ til_fb_fragment_put_pixel_unchecked(fragment, pos_x, pos_y,
makergb(sinf(M_1_PI*t)*127+128,
sinf(M_1_PI*t+(2*M_PI*.333333333333f))*127+128,
sinf(M_1_PI*t+(4*M_PI*.333333333333f))*127+128,
@@ -101,31 +102,31 @@ static void spiro_render_fragment(void *context, unsigned ticks, unsigned cpu, f
#ifdef DEBUG
/* plot the origin point */
- fb_fragment_put_pixel_unchecked(fragment, display_origin_x, display_origin_y,
+ til_fb_fragment_put_pixel_unchecked(fragment, display_origin_x, display_origin_y,
makergb(0xFF, 0xFF, 0x00, 1));
/* plot the fixed outer circle C0 */
for(float a=0.f; a<2*M_PI; a+= M_PI_2/display_R) {
int pos_x=display_origin_x+(cosf(a)*display_R);
int pos_y=display_origin_y+(sinf(a)*display_R);
- fb_fragment_put_pixel_unchecked(fragment, pos_x, pos_y,
+ til_fb_fragment_put_pixel_unchecked(fragment, pos_x, pos_y,
makergb(0xFF, 0xFF, 0x00, 1));
}
/* plot inner circle Ci */
- fb_fragment_put_pixel_unchecked(fragment, display_origin_x+display_R-(ctxt->r*display_R),
+ til_fb_fragment_put_pixel_unchecked(fragment, display_origin_x+display_R-(ctxt->r*display_R),
display_origin_y, makergb(0xFF, 0xFF, 0x00, 1));
for(float a=0.f; a<2*M_PI; a+= M_PI_2/display_R) {
int pos_x=display_origin_x+display_R-(ctxt->r*display_R)+
(cosf(a)*ctxt->r*display_R);
int pos_y=display_origin_y+(sinf(a)*ctxt->r*display_R);
- fb_fragment_put_pixel_unchecked(fragment, pos_x, pos_y,
+ til_fb_fragment_put_pixel_unchecked(fragment, pos_x, pos_y,
makergb(0xFF, 0xFF, 0x00, 1));
}
/* plot p */
- fb_fragment_put_pixel_unchecked(fragment, display_origin_x+display_R-(ctxt->r*display_R)+
+ til_fb_fragment_put_pixel_unchecked(fragment, display_origin_x+display_R-(ctxt->r*display_R)+
(ctxt->p*display_R), display_origin_y, makergb(0xFF, 0xFF, 0x00, 1));
#endif
@@ -144,7 +145,7 @@ static void spiro_render_fragment(void *context, unsigned ticks, unsigned cpu, f
}
-rototiller_module_t spiro_module = {
+til_module_t spiro_module = {
.create_context = spiro_create_context,
.destroy_context = spiro_destroy_context,
.render_fragment = spiro_render_fragment,
diff --git a/src/modules/stars/stars.c b/src/modules/stars/stars.c
index a50a099..56e7188 100644
--- a/src/modules/stars/stars.c
+++ b/src/modules/stars/stars.c
@@ -7,10 +7,11 @@
#include <unistd.h>
#include <math.h>
+#include "til.h"
+#include "til_fb.h"
+#include "til_settings.h"
+
#include "draw.h"
-#include "fb.h"
-#include "rototiller.h"
-#include "settings.h"
/* Copyright (C) 2017-20 Philip J. Freeman <elektron@halo.nu> */
@@ -94,7 +95,7 @@ static void stars_destroy_context(void *context)
}
-static void stars_render_fragment(void *context, unsigned ticks, unsigned cpu, fb_fragment_t *fragment)
+static void stars_render_fragment(void *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment)
{
stars_context_t *ctxt = context;
struct points* iterator;
@@ -113,7 +114,7 @@ static void stars_render_fragment(void *context, unsigned ticks, unsigned cpu, f
max_radius=1.f+((width+height)*.001f);
- fb_fragment_zero(fragment);
+ til_fb_fragment_zero(fragment);
iterator=ctxt->points;
for(;;)
@@ -147,7 +148,7 @@ static void stars_render_fragment(void *context, unsigned ticks, unsigned cpu, f
opacity = 1;
if (pos_x>0 && pos_x<width && pos_y>0 && pos_y<height)
- fb_fragment_put_pixel_unchecked(fragment, pos_x, pos_y,
+ til_fb_fragment_put_pixel_unchecked(fragment, pos_x, pos_y,
makergb(0xFF, 0xFF, 0xFF, opacity));
for(int my_y=floorf(pos_y-max_radius); my_y<=(int)ceilf(pos_y+max_radius); my_y++)
@@ -162,7 +163,7 @@ static void stars_render_fragment(void *context, unsigned ticks, unsigned cpu, f
continue;
- fb_fragment_put_pixel_unchecked(fragment, my_x, my_y,
+ til_fb_fragment_put_pixel_unchecked(fragment, my_x, my_y,
makergb(0xFF, 0xFF, 0xFF, opacity));
}
@@ -200,7 +201,7 @@ static void stars_render_fragment(void *context, unsigned ticks, unsigned cpu, f
ctxt->offset_y = tmp_y;
}
-int stars_setup(const settings_t *settings, setting_desc_t **next_setting)
+int stars_setup(const til_settings_t *settings, til_setting_desc_t **next_setting)
{
const char *rot_adj;
const char *rot_adj_values[] = {
@@ -213,15 +214,15 @@ int stars_setup(const settings_t *settings, setting_desc_t **next_setting)
NULL
};
- rot_adj = settings_get_value(settings, "rot_adj");
+ rot_adj = til_settings_get_value(settings, "rot_adj");
if(!rot_adj) {
int ret_val;
- ret_val = setting_desc_clone(&(setting_desc_t){
+ ret_val = til_setting_desc_clone(&(til_setting_desc_t){
.name = "Rotation Rate",
.key = "rot_adj",
.regex = "\\.[0-9]+",
- .preferred = SETTINGS_STR(DEFAULT_ROT_ADJ),
+ .preferred = TIL_SETTINGS_STR(DEFAULT_ROT_ADJ),
.values = rot_adj_values,
.annotations = NULL
}, next_setting);
@@ -236,7 +237,7 @@ int stars_setup(const settings_t *settings, setting_desc_t **next_setting)
return 0;
}
-rototiller_module_t stars_module = {
+til_module_t stars_module = {
.create_context = stars_create_context,
.destroy_context = stars_destroy_context,
.render_fragment = stars_render_fragment,
diff --git a/src/modules/submit/submit.c b/src/modules/submit/submit.c
index 7b4fd91..288a69a 100644
--- a/src/modules/submit/submit.c
+++ b/src/modules/submit/submit.c
@@ -20,10 +20,10 @@
#include <time.h>
#include <unistd.h>
-#include "fb.h"
-#include "rototiller.h"
-#include "settings.h"
-#include "util.h"
+#include "til.h"
+#include "til_fb.h"
+#include "til_settings.h"
+#include "til_util.h"
#include "grid/grid.h"
@@ -185,7 +185,7 @@ static inline uint32_t sample_grid(submit_context_t *ctxt, float x, float y)
}
-static void draw_grid(submit_context_t *ctxt, fb_fragment_t *fragment)
+static void draw_grid(submit_context_t *ctxt, til_fb_fragment_t *fragment)
{
float xscale = ((float)GRID_SIZE - 1.f) / (float)fragment->frame_width;
float yscale = ((float)GRID_SIZE - 1.f) / (float)fragment->frame_height;
@@ -196,13 +196,13 @@ static void draw_grid(submit_context_t *ctxt, fb_fragment_t *fragment)
/* TODO: this could be optimized a bit! i.e. don't recompute the y for every x etc. */
color = sample_grid(ctxt, .5f + ((float)(fragment->x + x)) * xscale, .5f + ((float)(fragment->y + y)) * yscale);
- fb_fragment_put_pixel_unchecked(fragment, fragment->x + x, fragment->y + y, color);
+ til_fb_fragment_put_pixel_unchecked(fragment, fragment->x + x, fragment->y + y, color);
}
}
}
-static void draw_grid_bilerp(submit_context_t *ctxt, fb_fragment_t *fragment)
+static void draw_grid_bilerp(submit_context_t *ctxt, til_fb_fragment_t *fragment)
{
float xscale = ((float)GRID_SIZE - 1.f) / (float)fragment->frame_width;
float yscale = ((float)GRID_SIZE - 1.f) / (float)fragment->frame_height;
@@ -213,7 +213,7 @@ static void draw_grid_bilerp(submit_context_t *ctxt, fb_fragment_t *fragment)
/* TODO: this could be optimized a bit! i.e. don't recompute the y for every x etc. */
color = sample_grid_bilerp(ctxt, .5f + ((float)(fragment->x + x)) * xscale, .5f + ((float)(fragment->y + y)) * yscale);
- fb_fragment_put_pixel_unchecked(fragment, fragment->x + x, fragment->y + y, color);
+ til_fb_fragment_put_pixel_unchecked(fragment, fragment->x + x, fragment->y + y, color);
}
}
}
@@ -284,13 +284,13 @@ static void submit_destroy_context(void *context)
}
-static int submit_fragmenter(void *context, const fb_fragment_t *fragment, unsigned number, fb_fragment_t *res_fragment)
+static int submit_fragmenter(void *context, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment)
{
- return fb_fragment_tile_single(fragment, 32, number, res_fragment);
+ return til_fb_fragment_tile_single(fragment, 32, number, res_fragment);
}
-static void submit_prepare_frame(void *context, unsigned ticks, unsigned n_cpus, fb_fragment_t *fragment, rototiller_fragmenter_t *res_fragmenter)
+static void submit_prepare_frame(void *context, unsigned ticks, unsigned n_cpus, til_fb_fragment_t *fragment, til_fragmenter_t *res_fragmenter)
{
submit_context_t *ctxt = context;
@@ -311,7 +311,7 @@ static void submit_prepare_frame(void *context, unsigned ticks, unsigned n_cpus,
}
-static void submit_render_fragment(void *context, unsigned ticks, unsigned cpu, fb_fragment_t *fragment)
+static void submit_render_fragment(void *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment)
{
submit_context_t *ctxt = context;
@@ -322,11 +322,11 @@ static void submit_render_fragment(void *context, unsigned ticks, unsigned cpu,
}
-static int submit_setup(const settings_t *settings, setting_desc_t **next_setting)
+static int submit_setup(const til_settings_t *settings, til_setting_desc_t **next_setting)
{
const char *bilerp;
- bilerp = settings_get_value(settings, "bilerp");
+ bilerp = til_settings_get_value(settings, "bilerp");
if (!bilerp) {
const char *values[] = {
"off",
@@ -335,7 +335,7 @@ static int submit_setup(const settings_t *settings, setting_desc_t **next_settin
};
int r;
- r = setting_desc_clone(&(setting_desc_t){
+ r = til_setting_desc_clone(&(til_setting_desc_t){
.name = "Bilinear Interpolation of Cell Colors",
.key = "bilerp",
.regex = NULL,
@@ -358,7 +358,7 @@ static int submit_setup(const settings_t *settings, setting_desc_t **next_settin
}
-rototiller_module_t submit_module = {
+til_module_t submit_module = {
.create_context = submit_create_context,
.destroy_context = submit_destroy_context,
.prepare_frame = submit_prepare_frame,
diff --git a/src/modules/swab/swab.c b/src/modules/swab/swab.c
index a8db372..44b9f21 100644
--- a/src/modules/swab/swab.c
+++ b/src/modules/swab/swab.c
@@ -21,11 +21,11 @@
#include <time.h>
#include <unistd.h>
-#include "din/din.h"
+#include "til.h"
+#include "til_fb.h"
+#include "til_util.h"
-#include "fb.h"
-#include "rototiller.h"
-#include "util.h"
+#include "din/din.h"
typedef struct swab_context_t {
@@ -92,15 +92,15 @@ static void swab_destroy_context(void *context)
}
-static int swab_fragmenter(void *context, const fb_fragment_t *fragment, unsigned number, fb_fragment_t *res_fragment)
+static int swab_fragmenter(void *context, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment)
{
swab_context_t *ctxt = context;
- return fb_fragment_slice_single(fragment, ctxt->n_cpus, number, res_fragment);
+ return til_fb_fragment_slice_single(fragment, ctxt->n_cpus, number, res_fragment);
}
-static void swab_prepare_frame(void *context, unsigned ticks, unsigned n_cpus, fb_fragment_t *fragment, rototiller_fragmenter_t *res_fragmenter)
+static void swab_prepare_frame(void *context, unsigned ticks, unsigned n_cpus, til_fb_fragment_t *fragment, til_fragmenter_t *res_fragmenter)
{
swab_context_t *ctxt = context;
@@ -111,7 +111,7 @@ static void swab_prepare_frame(void *context, unsigned ticks, unsigned n_cpus, f
}
-static void swab_render_fragment(void *context, unsigned ticks, unsigned cpu, fb_fragment_t *fragment)
+static void swab_render_fragment(void *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment)
{
swab_context_t *ctxt = context;
float cos_r = cos(ctxt->r);
@@ -134,13 +134,13 @@ static void swab_render_fragment(void *context, unsigned ticks, unsigned cpu, fb
color.b = din(ctxt->din, &(v3f_t){ .x = (float)x * xscale * .81f, .y = (float)y * yscale * .81f, .z = z2 }) * t;
pixel = color_to_uint32(color);
- fb_fragment_put_pixel_unchecked(fragment, x, y, pixel);
+ til_fb_fragment_put_pixel_unchecked(fragment, x, y, pixel);
}
}
}
-rototiller_module_t swab_module = {
+til_module_t swab_module = {
.create_context = swab_create_context,
.destroy_context = swab_destroy_context,
.prepare_frame = swab_prepare_frame,
diff --git a/src/modules/swarm/swarm.c b/src/modules/swarm/swarm.c
index 4ebd79e..0b320fb 100644
--- a/src/modules/swarm/swarm.c
+++ b/src/modules/swarm/swarm.c
@@ -24,8 +24,8 @@
#include <unistd.h>
#include <math.h>
-#include "fb.h"
-#include "rototiller.h"
+#include "til.h"
+#include "til_fb.h"
#define SWARM_SIZE (32 * 1024)
#define SWARM_ZCONST 4.f
@@ -236,13 +236,13 @@ static void swarm_update(swarm_context_t *ctxt, unsigned ticks)
}
-static void swarm_render_fragment(void *context, unsigned ticks, unsigned cpu, fb_fragment_t *fragment)
+static void swarm_render_fragment(void *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment)
{
swarm_context_t *ctxt = context;
swarm_update(ctxt, ticks);
- fb_fragment_zero(fragment);
+ til_fb_fragment_zero(fragment);
{
float fw = fragment->frame_width, fh = fragment->frame_height;
@@ -261,13 +261,13 @@ static void swarm_render_fragment(void *context, unsigned ticks, unsigned cpu, f
nc.x = nc.x * fw + fw;
nc.y = nc.y * fh + fh;
- fb_fragment_put_pixel_checked(fragment, nc.x, nc.y, color);
+ til_fb_fragment_put_pixel_checked(fragment, nc.x, nc.y, color);
}
}
}
-rototiller_module_t swarm_module = {
+til_module_t swarm_module = {
.create_context = swarm_create_context,
.destroy_context = swarm_destroy_context,
.render_fragment = swarm_render_fragment,
© All Rights Reserved