1 #include <bz/gfx/particle_drawing.h>
3 #include <bz/fx/particle_simulation_internal.h>
4 #include <bz/gfx/gfx.h>
6 //static void drawBasicParticle(size_t particleCount, float ticks, float spawnTick[], float lifetimes[], float positionX[], float positionY[], float sizes[], float colors[], float alpha[]);
8 void bzGfxDrawParticles(BZParticleSimulationID simulation
, BZDrawQueueID drawQueue
) {
11 for (size_t i
= 0; i
< simulation
->maxParticles
; ++i
) {
12 float particleStartTicks
= simulation
->spawnTime
[i
];
13 float lifetime
= simulation
->lifetime
[i
];
14 if (particleStartTicks
+ lifetime
>= simulation
->time
) {
15 if (simulation
->alpha
[i
] < 0.25f
) {
17 } else if (simulation
->alpha
[i
] < 0.50f
) {
18 bzFillP(23130);//bzFillP(23130);
19 } else if (simulation
->alpha
[i
] < 0.75f
) {
20 bzFillP(32125);//bzFillP(32125);
22 bzFillP(32735);//bzFillP(0xFF); // FIXME
25 bzSetPaletteColor(0, 0, simulation
->color
[i
]);
26 //bzSetGlobalBlendColor(simulation->color[i]);
28 bzMatrixSRT(&m
, simulation
->positionX
[i
], simulation
->positionY
[i
], simulation
->angle
[i
], simulation
->size
[i
], simulation
->size
[i
]);
29 bzSetGlobalViewMatrix(&m
);
30 //bzMatrixTRS(&m, 0, 0, simulation->angle[i], simulation->size[i], simulation->size[i]);
31 //bzSetGlobalLocalMatrix(&m);
33 if (drawQueue
!= NULL
) {
34 bzGfxDrawQueueRun(drawQueue
);
36 bzCircFill(0, 0, 1, 0);
43 bzSetGlobalViewMatrix(&m
);
44 //bzSetGlobalLocalMatrix(&m);
45 bzSetPaletteColor(0, 0, 0);
46 //bzSetGlobalBlendColor(0xFF);
49 //void bzGfxDrawParticles(BZParticleSimulationID simulation) {
52 // FIXME, allow registering draw lists for particles
54 // BZParticleSimulationDrawFunction drawFunction = drawBasicParticle; // FIXME, allow register others
55 // drawFunction(simulation->maxParticles, simulation->time, simulation->spawnTime, simulation->lifetime, simulation->positionX, simulation->positionY, simulation->size, simulation->color, simulation->alpha);
58 /*static void drawBasicParticle(size_t particleCount, float time, float spawnTime[], float lifetimes[], float positionX[], float positionY[], float sizes[], float colors[], float alpha[]) {
59 for (size_t i = 0; i < particleCount; ++i) {
60 float particleStartTicks = spawnTime[i];
61 float lifetime = lifetimes[i];
62 if (particleStartTicks + lifetime >= time) {
63 if (alpha[i] < 0.25f) {
65 } else if (alpha[i] < 0.50f) {
66 bzFillP(23130);//bzFillP(23130);
67 } else if (alpha[i] < 0.75f) {
68 bzFillP(32125);//bzFillP(32125);
70 bzFillP(32735);//bzFillP(0xFF); // FIXME
73 bzGfxDrawQueueRun(BZDrawQueueID drawQueue);
74 //bzCircFill(positionX[i], positionY[i], sizes[i], colors[i]);
80 //nil,32800.99988,▒,░,32735.99988