summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
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-09-11setup: drop interactive "Select " prefixVito Caputo
This seems unnecessary and doesn't always read well in combination with a given setting name string. Just get rid of it for now.
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-02-21settings: fixup win32 strndupVito Caputo
Using strlen on the input string isn't safe; it may be unterminated
2020-02-10libs/sig: triangle wave; sig_ops_tri / sig_new_tri()Vito Caputo
Added a triangle wave
2020-02-04libs/sig: square wave; sig_ops_sqr / sig_new_sqr()Vito Caputo
This builds minimally upon the existing sine wave code, just use the sign to drive the signal high or low. Wikipedia shows a third state for 0 values, but that's for a -1..+1 signal. I'm producing all 0-1 signals as it's more convenient for this application, but it seems like it would be awkward to return .5f for the 0 case. So 0 is being treated as just another positive value; high.
2020-02-04libs/sig: add sig_new_$op wrappersVito Caputo
Provides improved ergonomics when using the bulitin ops, and much appreciated arity and type checking.
2020-02-03libs/sig: add sig_ref()Vito Caputo
Added some rudimentary refcounting so sig_t's can be readily shared by multiple sig_t's.
2020-02-03libs/sig: remove ticks_ms modulo in sig_ops_sinVito Caputo
Seems broken, fix it correctly later.
2020-02-03libs/sig: fix sig_ops_sin hz floor checkVito Caputo
off by one order of magnitude
2020-02-03libs/sig: add sig_ops_invVito Caputo
map 0-1 inputs to their inverse 1-0
2020-02-03libs/sig: s/sig_ops_inv/sig_ops_neg/gVito Caputo
Rename inv->neg, preparation for a new sig_ops_inv for inverting 0..1 to 1..0
2020-02-03libs/sig: add sig_ops_divVito Caputo
Included a little hack to defend against divide by zero, seems reasonable given the intended use cases.
2020-02-03libs/sig: add sig_ops_{add,sub}Vito Caputo
2020-02-03libs/sig: add sig_ops_expand convenienceVito Caputo
This is a specialized version of sig_ops_scale which assumes a min..max range of -1..+1 nvidia register combiners docs describe this operation as "expand normal", and they have several variants, but I don't want to go too crazy here right now. Plain expand it is.
2020-02-03libs/sig: add sig_ops_scale w/test exampleVito Caputo
This assumes the input value is always 0-1, but may be used to produce values in any signed range, mapped linearly to the input.
2020-02-03libs/sig: add sig_ops_inv for additive inverseVito Caputo
aka negation
2020-02-03libs/sig: fixup sig_ops_sin to stay within 0-1Vito Caputo
The whole idea was to produce values 0-1, except of course sig_ops_{mult,const} where one could deliberately get out of these bounds. Everything else should stay within 0-1 as it makes everything much more composable.
2020-02-03libs/sig: add sig_ops_{max,min}Vito Caputo
Supply two sig_t *'s: a, b
2020-02-03libs/sig: add sig_ops_clampVito Caputo
Supply three sig_t *'s: value, min, max
2020-02-03libs/sig: add ops_{abs,ceil,floor,pow,round}Vito Caputo
Added a simple test exercising pow and round
2020-02-03libs/sig: consideration for sig_t.ctxt alignmentVito Caputo
The flexible array of void *'s would just align to a pointer, which may not be safe for all members of whatever gets shoved in here. In an effort to make it more robust, make it an array of a junk drawer union of types.
2020-02-03libs/sig: update comment for ops_lerp_initVito Caputo
Comment was vestigial from ops_mult.c which ops_lerp.c was derived from.
2020-02-03libs/sig: add sig_ops_rand random generatorVito Caputo
(Ab)uses rand_r by feeding ticks_ms as seedp for pseudo-random numbers deterministically derived from ticks_ms.
2020-02-03libs/sig: remove math.h include from ops_const.cVito Caputo
2020-02-03libs/sig: cosmetic rearrangementVito Caputo
Make sig_ops_t.destroy functions consistently after init, no functional changes.
2020-02-03libs/sig: add sig_ops_lerp linear interpoplationVito Caputo
This takes three signals; a, b, and t t controls the weight interpolating between a and b, they all key off the same time ticks_ms.
2020-02-03libs/sig: convert ops_sin_ctxt_t.hz to a sig_t *Vito Caputo
Now hz can vary with time as well...
2020-02-03libs/sig: intrduce sig_ops_constVito Caputo
The simplest of signals: a constant value. The immediate need for this is to convert ops_sin_ctxt_t.hz to another sig_t enabling varying hz with time, while still being able to have a fixed hz as well.
2020-02-03libs/sig: introduce a signal generator abstractionVito Caputo
This adds a small framework of sorts for creating and composing signal generators. Two generators are implemented at this time; sig_ops_sin and sig_ops_mult sig_ops_sin accepts a hz variable and will produce a sine wave of that frequency. sig_ops_mult accepts two sig_t generators and multiplies their outputs Callers may construct their own sig_ops_t ops structs and supply them to sig_new(), but it's expected that libs/sig will grow a collection of commonly used generators which can then be used by simply passing their sig_ops_$foo to sig_new(). See the test code at the bottom of libs/sig/sig.c for some contrived sample usage. Note by composing multiple sig_ops_sin generators with a sig_ops_mult generator, one can already easily construct a synth-like LFO generator. Some obvious todos are to add triangle/sawtooth/square wave generators. More compositional generators may be interesting as well, like additive and subtractive for example. Those will need to implement clipping, as it's expected that the generators *always* stay within unity (0-1). No modules use this yet, but I expect to wire this up to rtv for driving knobs.
2020-01-26knobs: add experimental rudimentary knobs APIVito Caputo
This is intended for modules to expose bindings for floats affecting rendering output that may be varied at runtime frame-to-frame. See the comment in knobs.h for more information. This commit only introduces the concept, no modules utilize it yet.
2020-01-26rototiller: move rototiller_module_t.setup()Vito Caputo
Cosmetic change, put setup with the other function pointers.
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: initialize start_tvVito Caputo
Missed this!
2020-01-25rototiller: s/t_offset/ticks_offset/gVito Caputo
Make naming consistent
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.
2020-01-08modules/flui2d: static-ify flui2d_setup()Vito Caputo
2020-01-08modules/drizzle: add a classic 2D raindrops visVito Caputo
Using the new puddle lib throw some raindrops on the framebuffer
2020-01-08libs/puddle: add a classic 2D raindrop sim libVito Caputo
These were commonish in the 90s demo days, done as a library to encourage use by different modules. You can simply render this directly onto a frame buffer like the old days, or sample it as a height map or density field for more complex compositions.
2020-01-06rtv: rework randomized module selectionVito Caputo
Switch to working through the set of modules in a random order, randomizing the order once per cycle. This way no modules get starved for display, which was pretty common in the old method.
2020-01-06stars: fat starsPhilip J Freeman
draw stars as circles that get larger as the approach the camera
2020-01-06spiro: spirograph emulatorPhilip J Freeman
This commit adds a module that emulates a spirograph
© All Rights Reserved