Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
ParticleBasicTimeUpdater.cpp
Go to the documentation of this file.
1
2
4
5namespace Divide {
6
8 U32 endID = p.aliveCount();
9 const F32 localDT = Time::MicrosecondsToSeconds<F32>(deltaTimeUS);
10
11 if (endID == 0) {
12 return;
13 }
14
15 for (U32 i = 0; i < endID; ++i) {
16 vec4<F32>& misc = p._misc[i];
17
18 misc.x -= localDT;
19 // interpolation: from 0 (start of life) till 1 (end of life)
20 misc.y =
21 1.0f - misc.x * misc.z; // .z is 1.0/max life time
22
23 if (misc.x <= 0.0f) {
24 p.kill(i);
25 endID = p.aliveCount() < p.totalCount() ? p.aliveCount()
26 : p.totalCount();
27 }
28 }
29}
30
31} //namespace Divide
void update(U64 deltaTimeUS, ParticleData &p) override
Container to store data for a given set of particles.
Definition: ParticleData.h:59
U32 aliveCount() const noexcept
Definition: ParticleData.h:117
U32 totalCount() const noexcept
Definition: ParticleData.h:118
void kill(U32 index)
vector< vec4< F32 > > _misc
x = time; y = interpolation; z = 1 / time; w = distance to camera sq;
Definition: ParticleData.h:74
Handle console commands that start with a forward slash.
Definition: AIProcessor.cpp:7
uint32_t U32
uint64_t U64