blob: 304d5e0d5a0c905be506b8c5bd3655a74dc185fa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#pragma once
#include <mutex>
#include "BLI_string_multi_map.h"
#include "particles_state.hpp"
namespace BParticles {
using BLI::StringMultiMap;
using FN::AttributesRefGroup;
class ParticleAllocator : BLI::NonCopyable, BLI::NonMovable {
private:
ParticlesState &m_state;
StringMultiMap<ParticleSet *> m_allocated_particles;
std::mutex m_request_mutex;
public:
ParticleAllocator(ParticlesState &state);
/**
* Access all particles that have been allocated by this allocator.
*/
StringMultiMap<ParticleSet *> allocated_particles();
/**
* Get memory buffers for new particles.
*/
AttributesRefGroup request(StringRef particle_system_name, uint size);
private:
void initialize_new_particles(AttributesRefGroup &attributes_group);
};
/* ParticleAllocator inline functions
********************************************/
inline StringMultiMap<ParticleSet *> ParticleAllocator::allocated_particles()
{
return m_allocated_particles;
}
} // namespace BParticles
|