Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
ParticleVelocityGenerator.cpp
Go to the documentation of this file.
1
2
4
5namespace Divide {
6
7void ParticleVelocityGenerator::generate(Task& packagedTasksParent,
8 TaskPool& parentPool,
9 [[maybe_unused]] const U64 deltaTimeUS,
10 ParticleData& p,
11 U32 startIndex,
12 U32 endIndex) {
15
16 //ToDo: Use parallel-for for this
17 using iter_t = decltype(std::begin(p._velocity));
18 for_each_interval<iter_t>(std::begin(p._velocity) + startIndex,
19 std::begin(p._velocity) + endIndex,
21 [&](iter_t from, iter_t to)
22 {
23 Start(*CreateTask(
24 &packagedTasksParent,
25 [from, to, min, max](const Task&) mutable
26 {
27 std::for_each(from, to, [&](vec4<F32>& velocity)
28 {
29 velocity.set(Random(min, max));
30 });
31 }),
32 parentPool);
33 });
34}
35
36} //namespace Divide
Container to store data for a given set of particles.
Definition: ParticleData.h:59
static constexpr U32 g_threadPartitionSize
Definition: ParticleData.h:61
vector< vec4< F32 > > _velocity
x,y,z = _velocity; w = angle;
Definition: ParticleData.h:70
Quaternion< F32 > _sourceOrientation
Handle console commands that start with a forward slash.
Definition: AIProcessor.cpp:7
uint32_t U32
uint64_t U64
void generate(Task &packagedTasksParent, TaskPool &parentPool, U64 deltaTimeUS, ParticleData &p, U32 startIndex, U32 endIndex) override