From 6385931985fa6fa8dd7ed69c20785d6b8d9cf37a Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Sat, 25 Jan 2020 17:26:54 -0800 Subject: rototiller: introduce ticks and wire up to modules Most modules find themselves wanting some kind of "t" value increasing with time or frames rendered. It's common for them to create and maintain this variable locally, incrementing it with every frame rendered. It may be interesting to introduce a global notion of ticks since rototiller started, and have all modules derive their "t" value from this instead of having their own private versions of it. In future modules and general innovations it seems likely that playing with time, like jumping it forwards and backwards to achieve some visual effects, will be desirable. This isn't applicable to all modules, but for many their entire visible state is derived from their "t" value, making them entirely reversible. This commit doesn't change any modules functionally, it only adds the plumbing to pull a ticks value down to the modules from the core. A ticks offset has also been introduced in preparation for supporting dynamic shifting of the ticks value, though no API is added for doing so yet. It also seems likely an API will be needed for disabling the time-based ticks advancement, with functions for explicitly setting its value. If modules are created for incorporating external sequencers and music coordination, they will almost certainly need to manage the ticks value explicitly. When a sequencer jumps forwards/backwards in the creative process, the module glue responsible will need to keep ticks synchronized with the sequencer/editor tool. Before any of this can happen, we need ticks as a first-class core thing shared by all modules. Future commits will have to modify existing modules to use the ticks appropriately, replacing their bespoke variants. --- src/modules/spiro/spiro.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/modules/spiro') diff --git a/src/modules/spiro/spiro.c b/src/modules/spiro/spiro.c index f6aeddc..b404c75 100644 --- a/src/modules/spiro/spiro.c +++ b/src/modules/spiro/spiro.c @@ -28,7 +28,7 @@ typedef struct spiro_context_t { } spiro_context_t; -static void * spiro_create_context(unsigned num_cpus) +static void * spiro_create_context(unsigned ticks, unsigned num_cpus) { spiro_context_t *ctxt; float z; @@ -60,7 +60,7 @@ static void spiro_destroy_context(void *context) } -static void spiro_render_fragment(void *context, unsigned cpu, fb_fragment_t *fragment) +static void spiro_render_fragment(void *context, unsigned ticks, unsigned cpu, fb_fragment_t *fragment) { spiro_context_t *ctxt = context; -- cgit v1.2.3