void particlesMove(struct particle_system *ps) { int i; int nbparticles = ps->particles.id; struct particle *p; i = 0; while(nbparticles < ps->particles.nbitems && i < ps->nbemitters) { if(--ps->emit[i].time <= 0) { add(ps->emit+i, &ps->particles); ps->emit[i].time = ps->emit[i].freq; } i++; } for(i = 0; i < nbparticles; i++) { p = (struct particle*)(ps->particles.pool) + i; applyForces(ps, p); if((--p->life < 0) || p->loc[0] > ps->maxx || p->loc[0] < ps->minx || p->loc[1] > ps->maxy || p->loc[1] < ps->miny || p->loc[2] > ps->maxz || p->loc[2] < ps->minz) { poolDelete(&ps->particles, i); } } poolFlush(&ps->particles); }
void libdwPoolClear(void) { poolFlush(pool); }