]> git.bts.cx Git - benzene.git/blob - src/bz/collision/particle_collision.c
Fixed Aseprite rendering system
[benzene.git] / src / bz / collision / particle_collision.c
1 #include <bz/collision/particle_collision.h>
2
3 #include <bz/fx/particle_simulation_internal.h>
4
5 void bzCollisionPopulateParticles(BZCollisionSpaceID space, BZParticleSimulationID simulation, BZIdentifierHash tagHash, float radiusMultiplier) {
6 BZCollisionShape s;
7
8 s.type = BZCollisionShapeTypeCircle;
9
10 for (size_t i = 0; i < simulation->maxParticles; ++i) {
11 float particleStartTicks = simulation->spawnTime[i];
12 float lifetime = simulation->lifetime[i];
13 if (particleStartTicks + lifetime >= simulation->time) {
14 s.circleOrigin.x = simulation->positionX[i];
15 s.circleOrigin.y = simulation->positionY[i];
16 s.circleRadius = simulation->size[i] * radiusMultiplier;
17 bzCollisionAddBody(space, BZCollisionBodyTypeSolid, &s, tagHash, (void *)i);
18 }
19 }
20 }