diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2022-04-30 10:13:23 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2022-05-01 21:02:44 -0700 |
commit | 17beb406f2033ef522b0aebee07bae64317fa8fe (patch) | |
tree | 0b19666754b4b47a68d9a803060367c3b4876475 /src/modules | |
parent | a59229c5513e73348c87bcfc5cc4b39a31012437 (diff) |
til_fb: add draw flags for controlling texturability
Just adds TIL_FB_DRAW_FLAG_TEXTURABLE so callers can granularly
inhibit texturing if desired.
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/blinds/blinds.c | 4 | ||||
-rw-r--r-- | src/modules/checkers/checkers.c | 2 | ||||
-rw-r--r-- | src/modules/drizzle/drizzle.c | 2 | ||||
-rw-r--r-- | src/modules/flui2d/flui2d.c | 2 | ||||
-rw-r--r-- | src/modules/meta2d/meta2d.c | 2 | ||||
-rw-r--r-- | src/modules/pixbounce/pixbounce.c | 2 | ||||
-rw-r--r-- | src/modules/plato/plato.c | 4 | ||||
-rw-r--r-- | src/modules/snow/snow.c | 2 | ||||
-rw-r--r-- | src/modules/sparkler/particles.c | 4 | ||||
-rw-r--r-- | src/modules/sparkler/rocket.c | 2 | ||||
-rw-r--r-- | src/modules/sparkler/simple.c | 2 | ||||
-rw-r--r-- | src/modules/sparkler/spark.c | 2 | ||||
-rw-r--r-- | src/modules/sparkler/xplode.c | 2 | ||||
-rw-r--r-- | src/modules/spiro/spiro.c | 12 | ||||
-rw-r--r-- | src/modules/stars/stars.c | 4 | ||||
-rw-r--r-- | src/modules/submit/submit.c | 4 | ||||
-rw-r--r-- | src/modules/swab/swab.c | 2 | ||||
-rw-r--r-- | src/modules/swarm/swarm.c | 6 |
18 files changed, 30 insertions, 30 deletions
diff --git a/src/modules/blinds/blinds.c b/src/modules/blinds/blinds.c index 0a8342e..c4a94c9 100644 --- a/src/modules/blinds/blinds.c +++ b/src/modules/blinds/blinds.c @@ -69,7 +69,7 @@ static inline void draw_blind_horizontal(til_fb_fragment_t *fragment, unsigned r /* XXX FIXME: use faster block style fill/copy if til_fb gets that */ for (unsigned y = 0; y < height; y++) { for (unsigned x = 0; x < fragment->width; x++) - til_fb_fragment_put_pixel_unchecked(fragment, fragment->x + x, fragment->y + y + row * row_height, 0xffffffff); + til_fb_fragment_put_pixel_unchecked(fragment, TIL_FB_DRAW_FLAG_TEXTURABLE, fragment->x + x, fragment->y + y + row * row_height, 0xffffffff); } } @@ -83,7 +83,7 @@ static inline void draw_blind_vertical(til_fb_fragment_t *fragment, unsigned col /* XXX FIXME: use faster block style fill/copy if til_fb gets that */ for (unsigned y = 0; y < fragment->height; y++) { for (unsigned x = 0; x < width; x++) - til_fb_fragment_put_pixel_unchecked(fragment, fragment->x + x + column * column_width, fragment->y + y, 0xffffffff); + til_fb_fragment_put_pixel_unchecked(fragment, TIL_FB_DRAW_FLAG_TEXTURABLE, fragment->x + x + column * column_width, fragment->y + y, 0xffffffff); } } diff --git a/src/modules/checkers/checkers.c b/src/modules/checkers/checkers.c index ba5f4c7..27da42b 100644 --- a/src/modules/checkers/checkers.c +++ b/src/modules/checkers/checkers.c @@ -147,7 +147,7 @@ static void checkers_render_fragment(void *context, unsigned ticks, unsigned cpu if (!state) til_fb_fragment_clear(fragment); else - til_fb_fragment_fill(fragment, 0xffffffff); + til_fb_fragment_fill(fragment, TIL_FB_DRAW_FLAG_TEXTURABLE, 0xffffffff); } diff --git a/src/modules/drizzle/drizzle.c b/src/modules/drizzle/drizzle.c index 4fb62f6..5717bc7 100644 --- a/src/modules/drizzle/drizzle.c +++ b/src/modules/drizzle/drizzle.c @@ -146,7 +146,7 @@ static void drizzle_render_fragment(void *context, unsigned ticks, unsigned cpu, color.z = puddle_sample(ctxt->puddle, &coord); pixel = color_to_uint32(color); - til_fb_fragment_put_pixel_unchecked(fragment, x, y, pixel); + til_fb_fragment_put_pixel_unchecked(fragment, 0, x, y, pixel); coord.x += xf; } diff --git a/src/modules/flui2d/flui2d.c b/src/modules/flui2d/flui2d.c index dae73d8..f8afffb 100644 --- a/src/modules/flui2d/flui2d.c +++ b/src/modules/flui2d/flui2d.c @@ -376,7 +376,7 @@ static void flui2d_render_fragment(void *context, unsigned ticks, unsigned cpu, dx1 += ctxt->fluid.dens_b[(int)IX(x1, y1)] * (X - x0); b = dx0 * (1.f - (Y - y0)) + dx1 * (Y - y0); - til_fb_fragment_put_pixel_unchecked(fragment, x, y, gamma_color_to_uint32_rgb(r, g, b)); + til_fb_fragment_put_pixel_unchecked(fragment, 0, x, y, gamma_color_to_uint32_rgb(r, g, b)); } } } diff --git a/src/modules/meta2d/meta2d.c b/src/modules/meta2d/meta2d.c index 01bbc58..24af28c 100644 --- a/src/modules/meta2d/meta2d.c +++ b/src/modules/meta2d/meta2d.c @@ -206,7 +206,7 @@ static void meta2d_render_fragment(void *context, unsigned ticks, unsigned cpu, color = (v3f_t){}; pixel = color_to_uint32(color); - til_fb_fragment_put_pixel_unchecked(fragment, x, y, pixel); + til_fb_fragment_put_pixel_unchecked(fragment, 0, x, y, pixel); } } } diff --git a/src/modules/pixbounce/pixbounce.c b/src/modules/pixbounce/pixbounce.c index e864763..b8b2572 100644 --- a/src/modules/pixbounce/pixbounce.c +++ b/src/modules/pixbounce/pixbounce.c @@ -218,7 +218,7 @@ static void pixbounce_render_fragment(void *context, unsigned ticks, unsigned cp int pix_offset = ((cursor_y/ctxt->multiplier)*pix_width) + (cursor_x/ctxt->multiplier); if(pix_map[ctxt->pix_num][pix_offset] == 0) continue; til_fb_fragment_put_pixel_unchecked( - fragment, ctxt->x+cursor_x, ctxt->y+cursor_y, + fragment, TIL_FB_DRAW_FLAG_TEXTURABLE, ctxt->x+cursor_x, ctxt->y+cursor_y, ctxt->color ); } diff --git a/src/modules/plato/plato.c b/src/modules/plato/plato.c index 163a785..18f02e3 100644 --- a/src/modules/plato/plato.c +++ b/src/modules/plato/plato.c @@ -563,7 +563,7 @@ static void draw_line(til_fb_fragment_t *fragment, int x1, int y1, int x2, int y minor -= x_delta; } - til_fb_fragment_put_pixel_checked(fragment, x1, y1, 0xffffffff); + til_fb_fragment_put_pixel_checked(fragment, TIL_FB_DRAW_FLAG_TEXTURABLE, x1, y1, 0xffffffff); } } else { /* Y-major */ @@ -573,7 +573,7 @@ static void draw_line(til_fb_fragment_t *fragment, int x1, int y1, int x2, int y minor -= y_delta; } - til_fb_fragment_put_pixel_checked(fragment, x1, y1, 0xffffffff); + til_fb_fragment_put_pixel_checked(fragment, TIL_FB_DRAW_FLAG_TEXTURABLE, x1, y1, 0xffffffff); } } } diff --git a/src/modules/snow/snow.c b/src/modules/snow/snow.c index dc49a1a..8befc92 100644 --- a/src/modules/snow/snow.c +++ b/src/modules/snow/snow.c @@ -60,7 +60,7 @@ static void snow_render_fragment(void *context, unsigned ticks, unsigned cpu, ti uint32_t pixel = rand_r(seed) % 256; #endif - til_fb_fragment_put_pixel_unchecked(fragment, x, y, pixel << 16 | pixel << 8 | pixel); + til_fb_fragment_put_pixel_unchecked(fragment, 0, x, y, pixel << 16 | pixel << 8 | pixel); } } } diff --git a/src/modules/sparkler/particles.c b/src/modules/sparkler/particles.c index a567cea..2389e93 100644 --- a/src/modules/sparkler/particles.c +++ b/src/modules/sparkler/particles.c @@ -265,7 +265,7 @@ static void draw_line(til_fb_fragment_t *fragment, int x1, int y1, int x2, int y minor -= x_delta; } - til_fb_fragment_put_pixel_checked(fragment, x1, y1, 0xffffffff); + til_fb_fragment_put_pixel_checked(fragment, TIL_FB_DRAW_FLAG_TEXTURABLE, x1, y1, 0xffffffff); } } else { /* Y-major */ @@ -275,7 +275,7 @@ static void draw_line(til_fb_fragment_t *fragment, int x1, int y1, int x2, int y minor -= y_delta; } - til_fb_fragment_put_pixel_checked(fragment, x1, y1, 0xffffffff); + til_fb_fragment_put_pixel_checked(fragment, TIL_FB_DRAW_FLAG_TEXTURABLE, x1, y1, 0xffffffff); } } } diff --git a/src/modules/sparkler/rocket.c b/src/modules/sparkler/rocket.c index 3885304..0949d30 100644 --- a/src/modules/sparkler/rocket.c +++ b/src/modules/sparkler/rocket.c @@ -129,7 +129,7 @@ static void rocket_draw(particles_t *particles, const particles_conf_t *conf, pa /* kill off parts that wander off screen */ return; - til_fb_fragment_put_pixel_unchecked(f, x, y, 0xff0000); + til_fb_fragment_put_pixel_unchecked(f, 0, x, y, 0xff0000); } diff --git a/src/modules/sparkler/simple.c b/src/modules/sparkler/simple.c index 14c5d49..78e415b 100644 --- a/src/modules/sparkler/simple.c +++ b/src/modules/sparkler/simple.c @@ -104,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; - til_fb_fragment_put_pixel_unchecked(f, x, y, makergb(0xff, 0xff, 0xff, ((float)ctxt->longevity / ctxt->lifetime))); + til_fb_fragment_put_pixel_unchecked(f, 0, 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 8eff728..8627baa 100644 --- a/src/modules/sparkler/spark.c +++ b/src/modules/sparkler/spark.c @@ -54,7 +54,7 @@ static void spark_draw(particles_t *particles, const particles_conf_t *conf, par /* offscreen */ return; - til_fb_fragment_put_pixel_unchecked(f, x, y, makergb(0xff, 0xa0, 0x20, ((float)ctxt->longevity / ctxt->lifetime))); + til_fb_fragment_put_pixel_unchecked(f, 0, x, y, makergb(0xff, 0xa0, 0x20, ((float)ctxt->longevity / ctxt->lifetime))); } diff --git a/src/modules/sparkler/xplode.c b/src/modules/sparkler/xplode.c index 931ec83..31f56fd 100644 --- a/src/modules/sparkler/xplode.c +++ b/src/modules/sparkler/xplode.c @@ -72,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)); } - til_fb_fragment_put_pixel_unchecked(f, x, y, color); + til_fb_fragment_put_pixel_unchecked(f, 0, x, y, color); } diff --git a/src/modules/spiro/spiro.c b/src/modules/spiro/spiro.c index f588638..b51b22d 100644 --- a/src/modules/spiro/spiro.c +++ b/src/modules/spiro/spiro.c @@ -91,7 +91,7 @@ static void spiro_render_fragment(void *context, unsigned ticks, unsigned cpu, t 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); - til_fb_fragment_put_pixel_unchecked(fragment, pos_x, pos_y, + til_fb_fragment_put_pixel_unchecked(fragment, TIL_FB_DRAW_FLAG_TEXTURABLE, 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, @@ -100,31 +100,31 @@ static void spiro_render_fragment(void *context, unsigned ticks, unsigned cpu, t #ifdef DEBUG /* plot the origin point */ - til_fb_fragment_put_pixel_unchecked(fragment, display_origin_x, display_origin_y, + til_fb_fragment_put_pixel_unchecked(fragment, 0, 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); - til_fb_fragment_put_pixel_unchecked(fragment, pos_x, pos_y, + til_fb_fragment_put_pixel_unchecked(fragment, 0, pos_x, pos_y, makergb(0xFF, 0xFF, 0x00, 1)); } /* plot inner circle Ci */ - til_fb_fragment_put_pixel_unchecked(fragment, display_origin_x+display_R-(ctxt->r*display_R), + til_fb_fragment_put_pixel_unchecked(fragment, 0, 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); - til_fb_fragment_put_pixel_unchecked(fragment, pos_x, pos_y, + til_fb_fragment_put_pixel_unchecked(fragment, 0, pos_x, pos_y, makergb(0xFF, 0xFF, 0x00, 1)); } /* plot p */ - til_fb_fragment_put_pixel_unchecked(fragment, display_origin_x+display_R-(ctxt->r*display_R)+ + til_fb_fragment_put_pixel_unchecked(fragment, 0, display_origin_x+display_R-(ctxt->r*display_R)+ (ctxt->p*display_R), display_origin_y, makergb(0xFF, 0xFF, 0x00, 1)); #endif diff --git a/src/modules/stars/stars.c b/src/modules/stars/stars.c index 43e7622..e975c7c 100644 --- a/src/modules/stars/stars.c +++ b/src/modules/stars/stars.c @@ -159,7 +159,7 @@ static void stars_render_fragment(void *context, unsigned ticks, unsigned cpu, t opacity = 1; if (pos_x>0 && pos_x<width && pos_y>0 && pos_y<height) - til_fb_fragment_put_pixel_unchecked(fragment, pos_x, pos_y, + til_fb_fragment_put_pixel_unchecked(fragment, TIL_FB_DRAW_FLAG_TEXTURABLE, 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++) @@ -174,7 +174,7 @@ static void stars_render_fragment(void *context, unsigned ticks, unsigned cpu, t continue; - til_fb_fragment_put_pixel_unchecked(fragment, my_x, my_y, + til_fb_fragment_put_pixel_unchecked(fragment, TIL_FB_DRAW_FLAG_TEXTURABLE, my_x, my_y, makergb(0xFF, 0xFF, 0xFF, opacity)); } diff --git a/src/modules/submit/submit.c b/src/modules/submit/submit.c index f0be5eb..1f3a2ae 100644 --- a/src/modules/submit/submit.c +++ b/src/modules/submit/submit.c @@ -200,7 +200,7 @@ static void draw_grid(submit_context_t *ctxt, til_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); - til_fb_fragment_put_pixel_unchecked(fragment, fragment->x + x, fragment->y + y, color); + til_fb_fragment_put_pixel_unchecked(fragment, 0, fragment->x + x, fragment->y + y, color); } } } @@ -217,7 +217,7 @@ static void draw_grid_bilerp(submit_context_t *ctxt, til_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); - til_fb_fragment_put_pixel_unchecked(fragment, fragment->x + x, fragment->y + y, color); + til_fb_fragment_put_pixel_unchecked(fragment, 0, fragment->x + x, fragment->y + y, color); } } } diff --git a/src/modules/swab/swab.c b/src/modules/swab/swab.c index 8c71049..90f7a36 100644 --- a/src/modules/swab/swab.c +++ b/src/modules/swab/swab.c @@ -127,7 +127,7 @@ static void swab_render_fragment(void *context, unsigned ticks, unsigned cpu, ti color.b = din(ctxt->din, &(v3f_t){ .x = xscaled * .81f, .y = yscaled * .81f, .z = z2 }) * t; pixel = color_to_uint32(color); - til_fb_fragment_put_pixel_unchecked(fragment, x, y, pixel); + til_fb_fragment_put_pixel_unchecked(fragment, 0, x, y, pixel); } } } diff --git a/src/modules/swarm/swarm.c b/src/modules/swarm/swarm.c index e2381ab..2d37e28 100644 --- a/src/modules/swarm/swarm.c +++ b/src/modules/swarm/swarm.c @@ -333,7 +333,7 @@ static void swarm_draw_as_points(swarm_context_t *ctxt, til_fb_fragment_t *fragm boid_t *b = &ctxt->boids[i]; v2f_t nc = swarm_scale(swarm_project_point(ctxt, &b->position), scale); - til_fb_fragment_put_pixel_checked(fragment, nc.x, nc.y, color); + til_fb_fragment_put_pixel_checked(fragment, TIL_FB_DRAW_FLAG_TEXTURABLE, nc.x, nc.y, color); } } @@ -357,7 +357,7 @@ static void draw_line_unchecked(til_fb_fragment_t *fragment, int x1, int y1, int minor -= x_delta; } /* XXX FIXME: segfaults occasionally when _unchecked !!! */ - til_fb_fragment_put_pixel_checked(fragment, x1, y1, color); + til_fb_fragment_put_pixel_checked(fragment, TIL_FB_DRAW_FLAG_TEXTURABLE, x1, y1, color); } } else { /* Y-major */ @@ -368,7 +368,7 @@ static void draw_line_unchecked(til_fb_fragment_t *fragment, int x1, int y1, int } /* XXX FIXME: segfaults occasionally when _unchecked !!! */ - til_fb_fragment_put_pixel_checked(fragment, x1, y1, color); + til_fb_fragment_put_pixel_checked(fragment, TIL_FB_DRAW_FLAG_TEXTURABLE, x1, y1, color); } } } |