Nazara Engine  0.4
A fast, complete, cross-platform API designed for game development
ParticleFunctionGenerator.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_PARTICLEFUNCTIONGENERATOR_HPP
8 #define NAZARA_PARTICLEFUNCTIONGENERATOR_HPP
9 
10 #include <Nazara/Prerequesites.hpp>
11 #include <Nazara/Graphics/ParticleGenerator.hpp>
12 #include <functional>
13 
14 namespace Nz
15 {
16  class ParticleFunctionGenerator;
17 
18  using ParticleFunctionGeneratorConstRef = ObjectRef<const ParticleFunctionGenerator>;
19  using ParticleFunctionGeneratorRef = ObjectRef<ParticleFunctionGenerator>;
20 
21  class NAZARA_GRAPHICS_API ParticleFunctionGenerator : public ParticleGenerator
22  {
23  public:
24  using Generator = std::function<void(ParticleGroup& /*group*/, ParticleMapper& /*mapper*/, unsigned int /*startId*/, unsigned int /*endId*/)>;
25 
26  inline ParticleFunctionGenerator(Generator controller);
28  ~ParticleFunctionGenerator() = default;
29 
30  void Generate(ParticleGroup& group, ParticleMapper& mapper, unsigned int startId, unsigned int endId) override final;
31 
32  inline const Generator& GetGenerator() const;
33 
34  inline void SetGenerator(Generator generator);
35 
36  template<typename... Args> static ParticleFunctionGeneratorRef New(Args&&... args);
37 
38  private:
39  Generator m_generator;
40  };
41 }
42 
43 #include <Nazara/Graphics/ParticleFunctionGenerator.inl>
44 
45 #endif // NAZARA_PARTICLEFUNCTIONGENERATOR_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
Core class that represents a reference to an object.
Definition: ObjectRef.hpp:18
Graphics class which generates particles.
Definition: ParticleGenerator.hpp:27
Helper class used to provide a function as a particle generator without going in the process of makin...
Definition: ParticleFunctionGenerator.hpp:21