diff options
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/checkers/checkers.c | 5 | ||||
-rw-r--r-- | src/modules/flui2d/flui2d.c | 2 | ||||
-rw-r--r-- | src/modules/meta2d/v2f.h | 4 | ||||
-rw-r--r-- | src/modules/meta2d/v3f.h | 6 | ||||
-rw-r--r-- | src/modules/mixer/mixer.c | 2 | ||||
-rw-r--r-- | src/modules/montage/montage.c | 10 | ||||
-rw-r--r-- | src/modules/plato/plato.c | 5 | ||||
-rw-r--r-- | src/modules/ray/ray.c | 2 | ||||
-rw-r--r-- | src/modules/rkt/rkt.c | 1 | ||||
-rw-r--r-- | src/modules/spiro/spiro.c | 1 | ||||
-rw-r--r-- | src/modules/swarm/swarm.c | 8 | ||||
-rw-r--r-- | src/modules/voronoi/v2f.h | 4 |
12 files changed, 26 insertions, 24 deletions
diff --git a/src/modules/checkers/checkers.c b/src/modules/checkers/checkers.c index 5987b7d..3608582 100644 --- a/src/modules/checkers/checkers.c +++ b/src/modules/checkers/checkers.c @@ -225,7 +225,6 @@ static int checkers_fragmenter(til_module_context_t *context, const til_fb_fragm static void checkers_prepare_frame(til_module_context_t *context, til_stream_t *stream, unsigned ticks, til_fb_fragment_t **fragment_ptr, til_frame_plan_t *res_frame_plan) { checkers_context_t *ctxt = (checkers_context_t *)context; - til_fb_fragment_t *fragment = *fragment_ptr; /* XXX: note cpu_affinity is required when fill_module is used, to ensure module_contexts * have a stable relationship to fragnum. Otherwise the output would be unstable because the @@ -277,6 +276,8 @@ static void checkers_render_fragment(til_module_context_t *context, til_stream_t case CHECKERS_PATTERN_RANDOM: state = hash((context->seed + fragment->number) * 0x61C88647) & 0x1; break; + default: + assert(0); } /* now that state has been determined, set the frame size */ @@ -299,6 +300,8 @@ static void checkers_render_fragment(til_module_context_t *context, til_stream_t case CHECKERS_DYNAMICS_RANDOM: /* note: the big multiply here is just to get up out of the low bits */ state &= hash((context->seed + fragment->number) * 0x61C88647 + (unsigned)((float)ticks * ctxt->setup->rate)) & 0x1; break; + default: + assert(0); } if (fill == CHECKERS_FILL_RANDOM || fill == CHECKERS_FILL_MIXED) diff --git a/src/modules/flui2d/flui2d.c b/src/modules/flui2d/flui2d.c index 09869b3..147bb32 100644 --- a/src/modules/flui2d/flui2d.c +++ b/src/modules/flui2d/flui2d.c @@ -365,7 +365,7 @@ static void flui2d_render_fragment(til_module_context_t *context, til_stream_t * y1 = y0 + 1; for (int x = fragment->x; x < fragment->x + fragment->width; x++) { - float X, dens, dx0, dx1; + float X, dx0, dx1; int x0, x1; float r, g, b; diff --git a/src/modules/meta2d/v2f.h b/src/modules/meta2d/v2f.h index 088772d..8483f00 100644 --- a/src/modules/meta2d/v2f.h +++ b/src/modules/meta2d/v2f.h @@ -281,8 +281,8 @@ static inline v2f_t * v2f_trilerp(v2f_t *res, const v2f_t *aaa, const v2f_t *aba static inline v2f_t _v2f_rand(unsigned *seedp, const v2f_t *min, const v2f_t *max) { return (v2f_t){ - .x = min->x + (float)rand_r(seedp) * (1.f/RAND_MAX) * (max->x - min->x), - .y = min->y + (float)rand_r(seedp) * (1.f/RAND_MAX) * (max->y - min->y), + .x = min->x + (float)rand_r(seedp) * (1.f/(float)RAND_MAX) * (max->x - min->x), + .y = min->y + (float)rand_r(seedp) * (1.f/(float)RAND_MAX) * (max->y - min->y), }; } diff --git a/src/modules/meta2d/v3f.h b/src/modules/meta2d/v3f.h index d923ecc..b1d3f4c 100644 --- a/src/modules/meta2d/v3f.h +++ b/src/modules/meta2d/v3f.h @@ -300,9 +300,9 @@ static inline v3f_t * v3f_cross(v3f_t *res, const v3f_t *a, const v3f_t *b) static inline v3f_t _v3f_rand(unsigned *seedp, const v3f_t *min, const v3f_t *max) { return (v3f_t){ - .x = min->x + (float)rand_r(seedp) * (1.f/RAND_MAX) * (max->x - min->x), - .y = min->y + (float)rand_r(seedp) * (1.f/RAND_MAX) * (max->y - min->y), - .z = min->z + (float)rand_r(seedp) * (1.f/RAND_MAX) * (max->z - min->z), + .x = min->x + (float)rand_r(seedp) * (1.f/(float)RAND_MAX) * (max->x - min->x), + .y = min->y + (float)rand_r(seedp) * (1.f/(float)RAND_MAX) * (max->y - min->y), + .z = min->z + (float)rand_r(seedp) * (1.f/(float)RAND_MAX) * (max->z - min->z), }; } diff --git a/src/modules/mixer/mixer.c b/src/modules/mixer/mixer.c index 55234d3..1a2566c 100644 --- a/src/modules/mixer/mixer.c +++ b/src/modules/mixer/mixer.c @@ -113,7 +113,7 @@ static void mixer_destroy_context(til_module_context_t *context) static inline float randf(unsigned *seed) { - return 1.f / RAND_MAX * rand_r(seed); + return 1.f / ((float)RAND_MAX) * rand_r(seed); } static void mixer_render_fragment(til_module_context_t *context, til_stream_t *stream, unsigned ticks, unsigned cpu, til_fb_fragment_t **fragment_ptr) diff --git a/src/modules/montage/montage.c b/src/modules/montage/montage.c index 18e1252..c7c2eb0 100644 --- a/src/modules/montage/montage.c +++ b/src/modules/montage/montage.c @@ -158,11 +158,10 @@ static int montage_fragment_tile(const til_fb_fragment_t *fragment, unsigned til */ static int montage_fragmenter(til_module_context_t *context, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment) { - montage_context_t *ctxt = (montage_context_t *)context; - float root = sqrtf(((montage_setup_t *)context->setup)->n_tiles); - unsigned tile_width = fragment->frame_width / ceilf(root); /* screens are wide, always give excess to the width */ - unsigned tile_height = fragment->frame_height / rintf(root); /* only give to the height when fraction is >= .5f */ - int ret; + float root = sqrtf(((montage_setup_t *)context->setup)->n_tiles); + unsigned tile_width = fragment->frame_width / ceilf(root); /* screens are wide, always give excess to the width */ + unsigned tile_height = fragment->frame_height / rintf(root); /* only give to the height when fraction is >= .5f */ + int ret; /* XXX: this could all be more clever and make some tiles bigger than others to deal with fractional square roots, * but this is good enough for now considering the simplicity. @@ -252,7 +251,6 @@ static int montage_setup(const til_settings_t *settings, til_setting_t **res_set tiles_settings = (*res_setting)->value_as_nested_settings; { til_setting_t *tile_setting; - const char *layer; for (size_t i = 0; til_settings_get_value_by_idx(tiles_settings, i, &tile_setting); i++) { if (!tile_setting->value_as_nested_settings) { diff --git a/src/modules/plato/plato.c b/src/modules/plato/plato.c index 5551268..f43eda3 100644 --- a/src/modules/plato/plato.c +++ b/src/modules/plato/plato.c @@ -524,6 +524,8 @@ static inline m4f_t m4f_rotate(const m4f_t *m, const v3f_t *axis, float radians) return m4f_mult(m, &rotate); } +#if 0 +/* these aren't currently used, but may come in handy later */ /* this is a simple perpsective projection matrix taken from an opengl tutorial */ static inline m4f_t m4f_frustum(float bot, float top, float left, float right, float nnear, float ffar) @@ -565,7 +567,7 @@ static inline uint32_t color_to_uint32(v3f_t color) { return pixel; } - +#endif static void draw_line(til_fb_fragment_t *fragment, int x1, int y1, int x2, int y2) { @@ -742,7 +744,6 @@ static int plato_setup(const til_settings_t *settings, til_setting_t **res_setti if (res_setup) { plato_setup_t *setup; - int i; setup = til_setup_new(settings, sizeof(*setup), NULL); if (!setup) diff --git a/src/modules/ray/ray.c b/src/modules/ray/ray.c index 9ed023d..ea44491 100644 --- a/src/modules/ray/ray.c +++ b/src/modules/ray/ray.c @@ -86,7 +86,7 @@ static ray_object_t lights[] = { .type = RAY_OBJECT_TYPE_LIGHT, .brightness = 15.0f, .emitter = { - .point.type = RAY_LIGHT_EMITTER_TYPE_POINT, + .point.type = RAY_OBJECT_TYPE_POINT, .point.center = { .x = 3.0f, .y = 3.0f, .z = 3.0f }, .point.surface = { .color = { .x = 1.0f, .y = 1.0f, .z = 1.0f }, diff --git a/src/modules/rkt/rkt.c b/src/modules/rkt/rkt.c index 3a7b880..257671a 100644 --- a/src/modules/rkt/rkt.c +++ b/src/modules/rkt/rkt.c @@ -368,7 +368,6 @@ static int rkt_setup(const til_settings_t *settings, til_setting_t **res_setting scenes_settings = (*res_setting)->value_as_nested_settings; { til_setting_t *scene_setting; - const char *scene_module; for (size_t i = 0; til_settings_get_value_by_idx(scenes_settings, i, &scene_setting); i++) { if (!scene_setting->value_as_nested_settings) { diff --git a/src/modules/spiro/spiro.c b/src/modules/spiro/spiro.c index ef9e7b6..75f4438 100644 --- a/src/modules/spiro/spiro.c +++ b/src/modules/spiro/spiro.c @@ -34,7 +34,6 @@ typedef struct spiro_context_t { static til_module_context_t * spiro_create_context(const til_module_t *module, til_stream_t *stream, unsigned seed, unsigned ticks, unsigned n_cpus, til_setup_t *setup) { spiro_context_t *ctxt; - float z; ctxt = til_module_context_new(module, sizeof(spiro_context_t), stream, seed, ticks, n_cpus, setup); if (!ctxt) diff --git a/src/modules/swarm/swarm.c b/src/modules/swarm/swarm.c index 8e2d853..97a04d0 100644 --- a/src/modules/swarm/swarm.c +++ b/src/modules/swarm/swarm.c @@ -197,9 +197,11 @@ static til_module_context_t * swarm_create_context(const til_module_t *module, t static void swarm_update(swarm_context_t *ctxt, unsigned ticks) { v3f_t avg_direction = {}; - float avg_velocity = 0.f; v3f_t avg_center = {}; float wleader, wcenter, wdirection; + /* commented out since it's unused currently and upsets -Wall -Werror, but retained for potential future modifications + * float avg_velocity = 0.f; + */ { /* [0] = leader */ float r = M_PI * 2 * ((cosf((float)ticks * .001f) * .5f + .5f)); @@ -239,10 +241,10 @@ static void swarm_update(swarm_context_t *ctxt, unsigned ticks) avg_center = v3f_add(avg_center, b->position); avg_direction = v3f_add(avg_direction, b->direction); - avg_velocity += b->velocity; + /* avg_velocity += b->velocity; */ } - avg_velocity *= (1.f / (float)SWARM_SIZE); + /* avg_velocity *= (1.f / (float)SWARM_SIZE); */ avg_center = v3f_mult_scalar(avg_center, (1.f / (float)SWARM_SIZE)); avg_direction = v3f_mult_scalar(avg_direction, (1.f / (float)SWARM_SIZE)); v3f_normalize(&avg_direction); diff --git a/src/modules/voronoi/v2f.h b/src/modules/voronoi/v2f.h index 8f51ee0..3cef962 100644 --- a/src/modules/voronoi/v2f.h +++ b/src/modules/voronoi/v2f.h @@ -281,8 +281,8 @@ static inline v2f_t * v2f_trilerp(v2f_t *res, const v2f_t *aaa, const v2f_t *aba static inline v2f_t _v2f_rand(const v2f_t *min, const v2f_t *max) { return (v2f_t){ - .x = min->x + (float)rand() * (1.f/RAND_MAX) * (max->x - min->x), - .y = min->y + (float)rand() * (1.f/RAND_MAX) * (max->y - min->y), + .x = min->x + (float)rand() * (1.f/(float)RAND_MAX) * (max->x - min->x), + .y = min->y + (float)rand() * (1.f/(float)RAND_MAX) * (max->y - min->y), }; } |