summaryrefslogtreecommitdiff
path: root/src/modules
AgeCommit message (Collapse)Author
2022-04-22modules/montage: stop assuming modules don't fragmentVito Caputo
There's been a longstanding todo item in montage where it was ignoring the fragmenter returned by a module's prepare_frame(). This commit continues with the single-threaded rendering of the modules within their respective tiles, still ad-hoc open coded. But now actually applies the fragmenter returned as if the rendering were being threaded, since when a module returns a fragmenter from its prepare_frame() it may strongly depend on that fragmenting for its output.
2022-04-19modules/blinds: add simple 80s-aesthetic window blindsVito Caputo
This isn't super interesting but I might just start adding simplistic overlay style modules for compositing/transition use.
2022-04-19*: s/til_fb_fragment_zero/til_fb_fragment_clear/Vito Caputo
Mechanical renaming of "zero" to "clear" throughout for this context.
2022-04-14modules/*: remove srand() initializationsVito Caputo
Just rely on til_init()'s srand() ensuring things are fresh.
2022-04-01modules/*: instantiate and use setupsVito Caputo
Now modules allocate and return an opaque setup pointer in res_setup when they implement a setup method. Defaults are utilized when ${module}_create_context() receives a NULL setup. The default setup used in this case should match the defaults/preferred values emitted by the module's setup method. But performing setup should always be optional, so a NULL setup provided to create_context() is to be expected. No cleanup of these setup instances is currently performed, so it's a small memory leak for now. Since these are opaque and may contain nested references to other allocations, simply using free() somewhere in the frontend is insufficient. There will probably need to be something like a til_module_t.setup_free() method added in the future which modules may assign libc's free() to when appropriate, or their own more elaborate version. Lifecycle for the settings is very simple; the setup method returns an instance, the caller is expected to free it when no longer needed (once free is implemented). The create_context consumer of a given setup must make its own copy of the settings if necessary, and may not keep a reference - it must assume the setup will be freed immediately after create_context() returns. This enables the ability to reuse a setup instance across multiple create_context() calls if desired, one can imagine something like running the same module with the same settings multiple times across multiple displays for instance. If the module has significant entropy the output will differ despite being configured identically... With this commit one may change settings for any of the modules *while* the modules are actively rendering a given context, and the settings should *not* be visible. They should only affect the context they're supplied to.
2022-03-30*: wire up context-specific setup instancesVito Caputo
This is a preparatory commit for cleaning up the existing sloppy global-ish application of settings during the iterative _setup() call sequences. Due to how this has evolved from a very rudimentary thing enjoying many assumptions about there ever only being a single module instance being configured by the settings, there's a lot of weirdness and inconsistency surrounding module setup WRT changes being applied instantaneously to /all/ existing and future context's renderings of a given module vs. requiring a new context be created to realize changes. This commit doesn't actually change any of that, but puts the plumbing in place for the setup methods to allocate and initialize a private struct encapsulating the parsed and validated setup once the settings are complete. This opaque setup pointer will then be provided to the associated create_context() method as the setup pointer. Then the created context can configure itself using the provided setup when non-NULL, or simply use defaults when NULL. A future commit will update the setup methods to allocate and populate their respective setup structs, adding the structs as needed, as well as updating their create_context() methods to utilize those setups. One consequence of these changes when fully realized will be that every setting change will require a new context be created from the changed settings for the change to be realized. For settings appropriately manipulated at runtime the concept of knobs was introduced but never finished. That will have to be finished in the future to enable more immediate/interactive changing of settings-like values appropriate for interactive manipulation
2022-03-30*: use til_module_create_context() in more placesVito Caputo
Just mechanical replacement of some remaining ad-hoc til_module_t.create_context() calls. The montage module continues using an ad-hoc call because it forces num_cpus=1 since it's already a threaded using a fragment per module's tile. This suggests the til_module_create_context() call should probably accept a num_cpus parameter, perhaps treating a 0 value as the "automagic" discover value so callers can explicitly set it when necessary.
2022-03-28modules/swarm: add lines drawing styleVito Caputo
Introduce drawing styles, adding a line style in addition to the existing points. Settings are style={points,lines}, default is now lines.
2022-03-28modules/swarm: remove extra ticks multiply on leader radsVito Caputo
No idea why this was in there. Though it makes the leader jump by huge values, since it still winds up as samples on the same path, just non-continuous, the swarm still appears correct, hiding this braino. If you reduce the SWARM_SIZE to a tiny number like 2 though, it becomes very obvious that the leader is teleporting all over the place.
2022-03-25modules/compose: -EINVAL on empty layers settingVito Caputo
This resulted in a NULL ptr deref, simply treating as invalid since what's the point of handling a composition devoid of any layers - it's probably a mistake.
2022-03-19modules/sparkler: clarify BSP-tree setting descsVito Caputo
attempt at making these more clear
2022-03-19*: de-constify til_setting_t throughoutVito Caputo
Now that til_setting_t.desc is not only a thing, but a thing that is intended to be refreshed regularly in the course of things like GUI interactive settings construction, it's not really appropriate to try even act like this these are const anymore.
2022-03-19*: use til_module_destroy_context()Vito Caputo
Mechanically replaced ad-hoc til_module_t.destroy_context() invocations with helper calls.
2022-03-19*: normalize setting description capitalizationsVito Caputo
Always only capitalize the first letter, never capitalize like titles.
2022-03-19*: drop til_module_t.licenseVito Caputo
Originally the thinking was that rototiller modules would become dlopen()ed shared objects, and that it would make sense to let them be licensed differently. At this time only some modules I have written were gplv3, Phil's modules are all gplv2, and I'm not inclined to pivot towards a dlopen model. So this commit drops the license field from til_module_t, relicenses my v3 code to v2, and adds a gplv2 LICENSE file to the source root dir. As of now rototiller+libtil and all its modules are simply gplv2, and anything linking in libtil must use a gplv2 compatible license - the expectation is that you just use gplv2.
2022-03-12til_settings: always describe relevant settingsVito Caputo
The existing iterative *_setup() interface only described settings not found, quietly accepting usable settings already present in the til_settings_t. This worked fine for the existing interactive text setup thing, but it's especially problematic for providing a GUI setup frontend. This commit makes it so the *_setup() methods always describe undescribed settings they recognize, leaving the setup frontend loop calling into the *_setup() methods to both apply the description validation if wanted and actually tie the description to respective setting returned by the _setup() methods as being related to the returned description. A new helper called til_settings_get_and_describe_value() has been introduced primarily for use of module setup methods to simplify this nonsense, replacing the til_settings_get_value() calls and surrounding logic, but retaining the til_setting_desc_t definitions largely verbatim. This also results in discarding of some ad-hoc til_setting_desc_check() calls, now that there's a centralized place where settings become "described" (setup_interactively in the case of rototiller). Now a GUI frontend (like glimmer) would just provide its own setup_interactively() equivalent for constructing its widgets for a given *_setup() method's chain of returned descs. Whereas in the past this wasn't really feasible unless there was never going to be pre-supplied settings. I suspect the til_setting_desc_check() integration into setup_interactively() needs more work, but I think this is good enough for now and I'm out of spare time for the moment.
2022-02-15modules/flui2d: introduce settable decay factorVito Caputo
The existing simulation would always accumulate, eventually filling the volume with density. This adds a decay to diminish the density, with the default less quickly filling the volume vs. before.
2022-02-15modules/*: remove inappropriate 'f' numeric suffixesVito Caputo
These are making it into the settings strings, it's benign only because regexps aren't currently being enforced. Fix it up anyways.
2021-10-01*: librototiller->libtilVito Caputo
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_.
2021-02-18modules/rtv: fix "none" snow to actually blankVito Caputo
This manifests in the current unconfigured rtv glimmer shows, since the default is a the "none" module when no settings are applied. But it turns out this isn't just a glimmer problem, "none" is advertised in the settings as a blanking alternative to snow. So it's actually broken in rototiller as well. This fixes it by detecting the nil "none" module's lack of any prepare_frame or render_fragment methods, and open coding the blanker with a fb_fragment_zero() inline.
2021-02-14*: split rototiller.[ch] into lib and mainVito Caputo
This is a first approximation of separating the core modules and threaded rendering from the cli-centric rototiller program and its sdl+drm video backends. Unfortunately this seemed to require switching over to libtool archives (.la) to permit consolidating the per-lib and per-module .a files into the librototiller.a and linking just with librototiller.a to depend on the aggregate of libs+modules+librototiller-glue in a simple fashion. If an alternative to .la comes up I will switch over to it, using libtool really slows down the build process. Those are implementation/build system details though. What's important in these changes is establishing something resembling a librototiller API boundary, enabling creating alternative frontends which vendor this tree as a submodule and link just to librototiller.{la,a} for all the modules+threaded rendering of them, while providing their own fb_ops_t for outputting into, and their own settings applicators for driving the modules setup.
2021-02-14compose,montage,rtv: drop author and license fieldsVito Caputo
These modules are meta modules, and the only place this information is presented currently is in the rtv module captions overlaying the visual output of unrelated modules. So it's rather misleading to put the meta module's author and license on-screen when what's being shown is arguably just a tiny fraction of the meta module's contribution. Rather than bother with constructing license and author lists at runtime from the modules incorporated by these meta modules, let's instead adopt a policy of meta modules omit any declaration of license or authorship outside of the source. This is a simple solution for now, it can be revisited later if necessary. Changing the .author member of rototiller_module_t to an .authors() function pointer wouldn't be difficult. But it does open up something of a can of worms when considering recursive dependencies and needing to construct unique authors and licenses lists from things like nested meta modules. Obviously there can't be infinite recursion as that would manifest in the rendering path as well, but what I'm more concerned about is properly handling potentialy quite long lists. It's already annoying when rtv has to deal with a long settings string, which I believe currently is just truncated. The same would have to be done with long authors/licenses I guess. In any case, I think it's probably fine to just leave authorship and license ambiguous when a meta module is shown in rtv. It's certainly preferable to vcaputo@pengaru.com getting credit for everything shown in the three meta modules currently implemented, or more specifically, the two shown in rtv; compose and montage. Note this required making rtv tolerante of NULL .license and .author rototiller_module_t members.
2021-02-08modules/*: normalize description capitalizationVito Caputo
Minor cosmetic consistency fixup
2021-02-08modules/swarm: implement a particles swarm moduleVito Caputo
Just a fun little swarm based loosely on 80s-era boids It would be interesting to make stuff like the # of particles and the weights runtime configurable, or exposed as knobs. Using a Z-buffer for occlusions and perhaps shading by depth might make a significant improvement on the visual quality. It might also be interesting to draw the particles as lines connecting their current position with their previous, instead as pixels. Or fat pixels like stars...
2021-02-07modules/plasma: normalize plasma dimensionsVito Caputo
This is a quick and dirty jab at normalizing the plasma size to be independent of the frame size. I kind of hate this module as-is, it's tempting to discard all the fixed point stuff and just redo it using floats.. the plasma itself isn't that attractive as-is either. But I have other things to work on currently, just wanted to make it so the plasma doesn't look like a solid color in the montage tile.
2021-02-07modules/plasma: trivial cleanupsVito Caputo
- move LUT initialization to context create - minor syntactic changes
2021-01-18modules/drizzle: low-hanging fruit optimizationsVito Caputo
- switch puddle_sample() to 0..1 coordinates to avoid some pointless extra arithmetic on every pixel - avoid redundant ->w multiplies in puddle_sample() - avoid multiplies in inner loops of drizzle_render_fragment() by accumulating coordinates w/addition instead I noticed full-screen 'compose' was struggling to keep a full frame rate on my laptop when testing with the new 'plato' layer. valgrind profiles showed drizzle as the big hog, mostly the puddle_sample() function. These changes help but it's still not great, getting much better will likely become invasive and crufty. It would be nice to cache the vertical lerp results and reuse them across puddle_sample() calls when valid, that might be a useful TODO. The runner-up is spiro, prolly some low-hanging fruit there as well, I haven't looked yet.
2021-01-17compose: add plato to default layersVito Caputo
now: "drizzle:stars:spiro:plato"
2021-01-17plato: regular convex polyhedrons in 3DVito Caputo
plato implements very simple software-rendered 3D models of the five convex regular polyhedra / Platonic solids Some TODO items: - procedurally generate vertices at runtime - add hidden surface removal setting (Z-buffer?) - add flat shaded rendering setting - add gouraud shading, maybe phong too? - show dual polyhedra This was more about slapping together a minimal 3D wireframe software renderer than anything to do with polyhedra, convex regular polyhedra just seemed like an excellent substrate since they're so simple to model.
2020-09-26modules/compose: set default layersVito Caputo
In case some code path creates module contexts and renders without applying settings, it's important to ensure there are defaults. As-is this would have crashed compose because compose_layers would have been NULL, and compose_create_context() assumed compose_layers always contained something useful. Montage would have been an example of this, though for other reasons montage has had compose disabled so I don't think anything currently would have triggered this.
2020-09-26modules/montage: skip compose moduleVito Caputo
The threaded rendering backend isn't reentrant and compose could hypothetically have montage as a layer triggering infinite recursion. For now use a big hammer and block compose module from montage.
2020-09-26modules/montage: cleanup vestigial stars/pixbounce lookupsVito Caputo
Once upon a time montage had to skip stars and pixbouce because they crashed. That has since been corrected, but the commit which removed the skips didn't remove the lookups. This removes the leftover lookups.
2020-09-26modules/montage: pass 1 for num_cpus when creating contextsVito Caputo
This module needs some love, but it already always supplies 1 to the open-coded rendering for the tiles. It never should have been supplying the real num_cpus to module.create_context(), then only supplying 1 for rendering.
2020-09-25modules/compose: add a rudimentary compositing moduleVito Caputo
--module=compose,layers=first:second:third:... this draws the named modules in the order listed, overdrawing the output of the previous layers in a cumulative fashion.
2020-09-25fb: track zeroed state in fb_fragment_tVito Caputo
This adds a bit flag for tracking if the fragment has been zeroed since its last flip/present. When a fresh frame comes back from flipping, its zeroed state is reset to false. When fb_fragment_zero() is called, it checks if zeroed is true, and skips the zeroing if so. If zeroed is false, fb_fragment_zero() will zero the fragment and set the zeroed flag to 1. This change is preparatory for layering the output of modules in a compositing fashion. Not all modules are amenable to being used as upper layers, since they inherently fill the screen with new pixels every frame. Those modules make good bottom or bg layers. Other modules perform fb_fragment_zero() every frame and add relatively few pixels atop a clean slate. These modules make good candidates for upper layers where this change becomes relevant.
2020-09-13modules/rtv: implement snow_module settingVito Caputo
This takes a module name or "none", to use the specified module or do nothing during the channel switching snow_duration. The default is "snow" like before.
2020-09-12modules/rtv: implement context_duration settingVito Caputo
This renames rtv_channel_t to rtv_module_t and modules to channels in various places, which arguably should have been in a separate commit but I'm not up for separating that out at the moment. Fundamentally what's happening is every channel is getting its own context which may persist across channel switches, this allows watching a variety of channels in a stateful manner before they get their contexts recreated with re-randomized settings. For modules without settings it's not terribly interesting, and I'm thinking modules should probably start deriving some of their state more directly from the global ticks rather than their own per-context counters and timers. That way even when their contexts get recreated with re-randomized settings, there can be some continuity for ticks-derived state. Deriving position for instance mathematically from ticks would allow things to be located continuously despite having their contexts and even settings changed, which may be interesting. Anyhow, if you want the previous behavior where contexts are always recreated on channel switch, just set the value to be contxt_duration equal to duration.
2020-09-12modules/rtv: s/ticket/order/Vito Caputo
Ticket is unnecessarily abstract/opaque of a name for this, it's simply the sort order. No point making the reader grok whatever model I was thinking when I wrote it at the time, i.e. tickets at a butcher counter.
2020-09-12modules/spiro: use ticks instead of time() w/srandVito Caputo
time() only changes every second, so this had the effect of freezing the seed a second at a time, affecting all rand() users, when spiro's create_context() was called more frequently than 1HZ. When using rtv with channels=spiro,duration=0 the create_context() gets called every other frame, and the visual results were very broken with the spiro only actually reseeding every second and the snow between each frame being static since it too uses rand() for seeding itself. This whole situation suggests no module should be calling srand(), and instead rototiller should probably call srand() once at startup and any modules that wish to use rand with a different seed should use rand_r(), and maybe rand() just for acquiring the seed like modules/snow does.
2020-09-12modules/rtv: rename rtv_skip_module()Vito Caputo
Purely cosmetic change renaming to rtv_should_skip_module() since the function doesn't actually skip anything, it just determines the skip.
2020-09-11modules/rtv: make channels set configurableVito Caputo
This adds a colon-separated channels setting, with a setting of "all" for the existing all-modules behavior. Colon was used since comma is already taken by the settings separator, maybe in the future comma escaping can be added everywhere relevant but for now just keep it simple. The immediate value of this setting is telling rtv to limit itself to a single module, and using its setting randomizer to automatically observe a variety of the available settings in action on a specific module, especially during development. If knobs ever get added in the future I expect this will become even more interesting for watching specific modules under their various settings permutations in combination with their knobs being twisted - especially if rtv reconstructs random signal generator chains for the "knob-twisters" on every channel switch. An immediately interesting TODO complementing this particular change would be optionally preserving module contexts across channel switches, so when the same module is revisited it resumes where it was last seen. But this conflicts with settings changes on channel switching, since contexts should probably always be recreated when settings change - but that's probably a module-specific detail that modules should just be robust enough to tolerate as in they'd safely ignore settings changes without a context recreate, or apply them if they safely can without a context recreate... TODO.
2020-09-11modules/rtv: make durations configurableVito Caputo
This adds three rtv settings: duration, caption_duration, snow_duration
2020-09-11module/sparkler: implement some BSP drawing settingsVito Caputo
This commit adds a few settings for visualizing the octree BSP: show_bsp_leafs (on/off): Draw wireframe cubes around octree leaf nodes show_bsp_leafs_min_depth (0,4,6,8,10): Set minimum octree depth for leaf nodes displayed show_bsp_matches (on/off): Draw lines connecting BSP search matches show_bsp_matches_affected_only (on/off): Limit drawn BSP search matches to only matches actually affected by the simulation The code implementing this stuff is a bit crufty, fb_fragment_t had to be pulled down to the sim ops for example and whether that actually results in drawing occurring during the sim phase depends on the config used and how the particle implementations react to the config... it's just gross. This matters because the caller used to know only the draw phase touched fb_fragment_t, and because of that the fragment was zeroed after sim and before draw in parallel. But now the caller needs to know if the config would make sim do some drawing, and do the fragment zeroing before sim instead, and skip the zero before draw to not lose what sim drew. It's icky, but I'll leave it for now, at least it's isolated to the sparkler.
2020-09-11modules/sparkler: wire up particles_conf_t settingsVito Caputo
These don't actually do anything yet
2020-09-11modules/sparkler: add particles conf parameterVito Caputo
Just stubbed out for now, wanting to restore some octree overlays like the old standalone sparkler had. Those can be wired up to settings so rtv can occasionally show the spatial partition and matched particles.
2020-02-21modules/snow: use rand() on WIN32Vito Caputo
My current version of mingw in debian 9.11 doesn't seem to have rand_r(), so let's just use plain rand() and lose the improved parallelization on win builds.
2020-01-25modules/flui2d: derive r from ticksVito Caputo
Modulo ticks by 2*M_PI to preserve precision by constraining the float to 2*M_PI radians.
2020-01-25rototiller: introduce ticks and wire up to modulesVito Caputo
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.
2020-01-23stars: mess with the starfieldPhilip J Freeman
This commit adds some fun features to the starfield: - normalize aspect ratio to fragment size - rolling viewport - rotating viewport (with rate option)
2020-01-12libs/ray: decouple film and frame dimensionsVito Caputo
The existing code conflated the rendered frame dimensions with what's essentially the virtual camera's film dimensions. That resulted in a viewing frustum depending on the rendered frame dimensions. Smaller frames (like in the montage module) would show a smaller viewport into the same scene. Now the view into the scene always shows the same viewport in terms of the frustum dimensions for a given combination of focal_length and film_{width,height}. The rendered frame is essentially a sampling of the 2D plane (the virtual film) intersecting the frustum. Nothing is done to try enforce a specific aspect ratio or any such magic. The caller is expected to manage this for now, or just ignore it and let the output be stretched when the aspect ratio of the output doesn't match the virtual film's aspect ratio. In the future it might be interesting to support letter boxing or such things for preserving the film's aspect ratio. For now the ray module just lets things be stretched, with hard-coded film dimensions of something approximately consistent with the past viewport. The ray module could make some effort to fit the hard-coded film dimensions to the runtime aspect ratio for the frame to be rendered, tweaking things as needed but generally preserving the general hard-coded dimensions. Allowing the frustum to be minimally adjusted to fit the circumstances... that might also be worth shoving into libray. Something of a automatic fitting mode for the camera.
© All Rights Reserved