From dc6138466fb680d7d3919d5b96a4151d924140e0 Mon Sep 17 00:00:00 2001 From: Philip J Freeman Date: Mon, 30 Dec 2019 13:59:16 -0800 Subject: stars: fat stars draw stars as circles that get larger as the approach the camera --- src/modules/stars/stars.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/src/modules/stars/stars.c b/src/modules/stars/stars.c index 9c1de5b..bf7678a 100644 --- a/src/modules/stars/stars.c +++ b/src/modules/stars/stars.c @@ -88,6 +88,8 @@ static void stars_render_fragment(void *context, unsigned cpu, fb_fragment_t *fr int width = fragment->width, height = fragment->height; + float max_radius=1.f+((width+height)*.001f); + fb_fragment_zero(fragment); iterator=ctxt->points; @@ -113,15 +115,30 @@ static void stars_render_fragment(void *context, unsigned cpu, fb_fragment_t *fr pos_x = ((x+1.f)*.5f)*(float)width; pos_y = ((y+1.f)*.5f)*(float)height; - if (pos_x>0 && pos_x0 && pos_y < height) { - if(iterator->z<0.1) - opacity = iterator->z*10; - else - opacity = 1; + if(iterator->z<0.1) + opacity = iterator->z*10; + else + opacity = 1; + if (pos_x>0 && pos_x0 && pos_y0 && my_x0 && my_y powf((iterator->z*max_radius), 2)) + continue; + + + fb_fragment_put_pixel_unchecked(fragment, my_x, my_y, + makergb(0xFF, 0xFF, 0xFF, opacity)); + } iterator->z += 0.01; -- cgit v1.2.3