blob: 6bd41e03825930e5026b3f68c81cf5662a83e20f (
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
46
47
48
49
50
51
52
53
54
55
56
|
#ifndef __JE_PARTICLE_BATCH_H__
#define __JE_PARTICLE_BATCH_H__
#include <list>
#include "je_particle.h"
namespace JinEngine
{
namespace Graphics
{
namespace Particles
{
///
/// Particle pool for reducing memory fragmentation.
///
class ParticlePool
{
public:
///
/// Particle pool constructor.
///
/// @param count Max count of particles.
///
ParticlePool(uint count);
///
/// Particle pool destructor.
///
~ParticlePool();
///
/// Claim a particle if available.
///
Particle* claim();
///
/// Recycle particle if the particle is no more alive.
///
void recycle(Particle* particle);
private:
///
/// All particles include available and inavailable particles.
///
std::list<Particle> particles;
};
} // namespace Particles
} // namespace Graphics
} // namespace JinEngine
#endif
|