diff options
author | Vito Caputo <vcaputo@gnugeneration.com> | 2016-12-13 07:51:23 -0800 |
---|---|---|
committer | Vito Caputo <vcaputo@gnugeneration.com> | 2016-12-13 07:51:23 -0800 |
commit | 8add1663d9a02db2bc65224cdceb480733a81379 (patch) | |
tree | fea6aa880a366c007d2b7fdda87c746e6345b301 /modules/sparkler/particles.h | |
parent | af49b97cd819cec3a19b1ff5ed6076a0d23f4233 (diff) |
sparkler: introduce a particle system
A while ago I made this particle system on SDL, and had the beginnings of
an octree implemented within it, but never finished actually using the
octree to accelerate the proximity searches.
This now has the octree completed and of course more particle interactions now
that neighbors could be found more quickly.
The simulation somewhat resembles a fireworks display. Every particle is drawn
as a single pixel. The visual effect is dominated by spontaneously spawned
rockets which explode into thousands of particles accompanied by bursts that
thrust particles away from the explosion radially in an expanding sphere
resembling a shock wave. When the shock wave happens to strike another rocket,
it explodes, resulting in another shock wave. This can produce spectacular
chain reactions, so it's worth running for some time and seeing what transpires.
Diffstat (limited to 'modules/sparkler/particles.h')
-rw-r--r-- | modules/sparkler/particles.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/modules/sparkler/particles.h b/modules/sparkler/particles.h new file mode 100644 index 0000000..689934b --- /dev/null +++ b/modules/sparkler/particles.h @@ -0,0 +1,21 @@ +#ifndef _PARTICLES_H +#define _PARTICLES_H + +#include "bsp.h" +#include "fb.h" +#include "list.h" +#include "particle.h" + +typedef struct particles_t particles_t; + +particles_t * particles_new(void); +void particles_draw(particles_t *particles, fb_fragment_t *fragment); +particle_status_t particles_sim(particles_t *particles); +void particles_age(particles_t *particles); +void particles_free(particles_t *particles); +int particles_add_particle(particles_t *particles, particle_props_t *props, particle_ops_t *ops); +void particles_spawn_particle(particles_t *particles, particle_t *parent, particle_props_t *props, particle_ops_t *ops); +void particles_add_particles(particles_t *particles, particle_props_t *props, particle_ops_t *ops, int num); +bsp_t * particles_bsp(particles_t *particles); + +#endif |