Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
ParticleSphereVelocityGenerator.cpp
Go to the documentation of this file.
1
2
4
5namespace Divide {
6
7void ParticleSphereVelocityGenerator::generate([[maybe_unused]] Task& packagedTasksParent,
8 [[maybe_unused]] TaskPool& parentPool,
9 [[maybe_unused]] const U64 deltaTimeUS,
10 ParticleData& p,
11 const U32 startIndex,
12 const U32 endIndex) {
13 for (U32 i = startIndex; i < endIndex; ++i) {
14 const F32 phi = Random(-M_PI_f, M_PI_f);
15 const F32 theta = Random(-M_PI_f, M_PI_f);
16 const F32 v = Random(_minVel, _maxVel);
17 const F32 r = v * std::sin(phi);
18 vec4<F32>& vel = p._velocity[i];
19 vel.set(r * std::cos(theta), r * std::sin(theta), v * std::cos(phi), vel.w);
20 }
21}
22}
Container to store data for a given set of particles.
Definition: ParticleData.h:59
vector< vec4< F32 > > _velocity
x,y,z = _velocity; w = angle;
Definition: ParticleData.h:70
void set(const T *v) noexcept
set the 4 components of the vector manually using a source pointer to a (large enough) array
Definition: MathVectors.h:1241
Handle console commands that start with a forward slash.
Definition: AIProcessor.cpp:7
constexpr F32 M_PI_f
Definition: MathHelper.h:86
T Random()
Definition: MathHelper.inl:95
uint32_t U32
uint64_t U64
void generate(Task &packagedTasksParent, TaskPool &parentPool, U64 deltaTimeUS, ParticleData &p, U32 startIndex, U32 endIndex) override