summaryrefslogtreecommitdiff
path: root/src/modules/flow
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2023-09-03 17:09:05 -0700
committerVito Caputo <vcaputo@pengaru.com>2023-09-03 17:09:05 -0700
commit76c48cfffbac6cb40103c99eb76c0847b0d1a16a (patch)
treee9063d8d3eb851a3c876f75a0240e66e86d10e71 /src/modules/flow
parentee03d186124ff6cc27e76fd2054376b1488de5c9 (diff)
modules/flow: don't reap elements on screen-space exit
This is too aggressive and produces some undesirable visible artifacts on the periphery, especially for slow-moving small-size fields. In such scenarios the elements near the edges would be excessively pruned when the direction wandered off-screen, then leaving an overly sparse region when the direction inevitably wandered back. This is still an issue but it's far less prominent when only clipping to the flow field boundaries... since the FOV doesn't quite encompass the edges of the flow field. Now the elements can survive wandering a bit off-screen, and re-enter.
Diffstat (limited to 'src/modules/flow')
-rw-r--r--src/modules/flow/flow.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/modules/flow/flow.c b/src/modules/flow/flow.c
index 973fad0..8b1386d 100644
--- a/src/modules/flow/flow.c
+++ b/src/modules/flow/flow.c
@@ -164,8 +164,9 @@ static void flow_render_fragment(til_module_context_t *context, til_stream_t *st
x = (pos.x * 2.f - 1.f) / (pos.z + ZCONST) * fragment->width + (fragment->width >> 1);
y = (pos.y * 2.f - 1.f) / (pos.z + ZCONST) * fragment->height + (fragment->height >> 1) ;
- if (!til_fb_fragment_put_pixel_checked(fragment, TIL_FB_DRAW_FLAG_TEXTURABLE, x, y, color_to_uint32_rgb(d.color)) ||
- pos.x < 0.f || pos.x > 1.f ||
+ (void) til_fb_fragment_put_pixel_checked(fragment, TIL_FB_DRAW_FLAG_TEXTURABLE, x, y, color_to_uint32_rgb(d.color));
+
+ if (pos.x < 0.f || pos.x > 1.f ||
pos.y < 0.f || pos.y > 1.f ||
pos.z < 0.f || pos.z > 1.f)
*e = rand_element(&ctxt->til_module_context.seed);
© All Rights Reserved