Peoplemon  0.1.0
Peoplemon 3 game source documentation
Particles.hpp
Go to the documentation of this file.
1 #ifndef GAME_STATES_EVOLUTION_PARTICLES_HPP
2 #define GAME_STATES_EVOLUTION_PARTICLES_HPP
3 
4 #include <BLIB/Particles.hpp>
6 #include <glm/glm.hpp>
7 
8 namespace game
9 {
10 namespace state
11 {
13 namespace evo
14 {
20 struct GpuSpark {
21  glm::vec2 pos;
22  float radius;
23  float alpha;
24 
25  GpuSpark() = default;
26 
28  pos = spark.position;
29  radius = spark.radius;
30  alpha = 1.f - spark.time / spark.lifetime;
31  return *this;
32  }
33 };
34 
40 class SparkEmitter : public bl::pcl::Emitter<Evolution::Spark> {
41 public:
42  SparkEmitter();
43  virtual ~SparkEmitter() = default;
44 
45 private:
46  float residual;
47 
48  virtual void update(Emitter::Proxy& proxy, float dt, float) override;
49 };
50 
56 class SparkSink : public bl::pcl::Sink<Evolution::Spark> {
57 public:
58  virtual ~SparkSink() = default;
59 
60 private:
61  virtual void update(Proxy& proxy, std::span<Evolution::Spark> particles, float dt,
62  float) override;
63 };
64 
70 class SparkAffector : public bl::pcl::Affector<Evolution::Spark> {
71 public:
72  virtual ~SparkAffector() = default;
73 
74 private:
75  virtual void update(Proxy& proxy, float dt, float) override;
76 };
77 
78 } // namespace evo
79 } // namespace state
80 } // namespace game
81 
82 #endif
Parent namespace for all functionality unique to the game.
GPU particle payload for the evolution sparks particle system.
Definition: Particles.hpp:20
GpuSpark & operator=(const Evolution::Spark &spark)
Definition: Particles.hpp:27
Spark emitter for the evolution sparks particle system.
Definition: Particles.hpp:40
virtual ~SparkEmitter()=default
Spark sink for the evolution sparks particle system.
Definition: Particles.hpp:56
virtual ~SparkSink()=default
Spark affector for the evolution sparks particle system.
Definition: Particles.hpp:70
virtual ~SparkAffector()=default