Nazara Engine  0.4
A fast, complete, cross-platform API designed for game development
ParticleEmitter.hpp
1 // Copyright (C) 2017 Jérôme Leclercq
2 // This file is part of the "Nazara Engine - Graphics module"
3 // For conditions of distribution and use, see copyright notice in Config.hpp
4 
5 #pragma once
6 
7 #ifndef NAZARA_PARTICLEEMITTER_HPP
8 #define NAZARA_PARTICLEEMITTER_HPP
9 
10 #include <Nazara/Prerequesites.hpp>
11 #include <Nazara/Core/Signal.hpp>
12 #include <Nazara/Graphics/Config.hpp>
13 
14 namespace Nz
15 {
16  class ParticleMapper;
17  class ParticleGroup;
18 
19  class NAZARA_GRAPHICS_API ParticleEmitter
20  {
21  public:
23  ParticleEmitter(const ParticleEmitter& emitter);
25  virtual ~ParticleEmitter();
26 
27  virtual void Emit(ParticleGroup& system, float elapsedTime) const;
28 
29  void EnableLagCompensation(bool enable);
30 
31  std::size_t GetEmissionCount() const;
32  float GetEmissionRate() const;
33 
34  bool IsLagCompensationEnabled() const;
35 
36  void SetEmissionCount(std::size_t count);
37  void SetEmissionRate(float rate);
38 
39  ParticleEmitter& operator=(const ParticleEmitter& emitter) = default;
40  ParticleEmitter& operator=(ParticleEmitter&& emitter);
41 
42  // Signals:
43  NazaraSignal(OnParticleEmitterMove, ParticleEmitter* /*oldParticleEmitter*/, ParticleEmitter* /*newParticleEmitter*/);
44  NazaraSignal(OnParticleEmitterRelease, const ParticleEmitter* /*particleEmitter*/);
45 
46  private:
47  virtual void SetupParticles(ParticleMapper& mapper, unsigned int count) const = 0;
48 
49  bool m_lagCompensationEnabled;
50  mutable float m_emissionAccumulator;
51  float m_emissionRate;
52  std::size_t m_emissionCount;
53  };
54 }
55 
56 #endif // NAZARA_PARTICLEEMITTER_HPP
TODO: Inherit SoundEmitter from Node.
Definition: Algorithm.hpp:12
Graphics class that represents the mapping between the internal buffer and the particle declaration...
Definition: ParticleMapper.hpp:17
Graphics class that represents an emitter of particles.
Definition: ParticleEmitter.hpp:19