CEmitter.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #pragma once
  2. #include "WallpaperEngine/Core/Core.h"
  3. namespace WallpaperEngine::Core::Objects::Particles {
  4. using json = nlohmann::json;
  5. /**
  6. * Particle emitter, controls the area where the particles have to be created
  7. */
  8. class CEmitter {
  9. public:
  10. static CEmitter* fromJSON (json data);
  11. /**
  12. * @return The ID of the emitter
  13. */
  14. [[nodiscard]] uint32_t getId () const;
  15. /**
  16. * @return The name of the emitter, indicates what type of emission to do
  17. */
  18. [[nodiscard]] const std::string& getName () const;
  19. /**
  20. * @return The maximum distance a particle can travel before being dead
  21. */
  22. [[nodiscard]] const glm::vec3& getDistanceMax () const;
  23. /**
  24. * @return The minimum distance a particle can travel before being dead
  25. */
  26. [[nodiscard]] const glm::vec3& getDistanceMin () const;
  27. /**
  28. * @return The direction a particle should move to
  29. */
  30. [[nodiscard]] const glm::vec3& getDirections () const;
  31. /**
  32. * @return The center of the particle emission
  33. */
  34. [[nodiscard]] const glm::vec3& getOrigin () const;
  35. /**
  36. * @return The rate of particle emission
  37. */
  38. [[nodiscard]] const double getRate () const;
  39. protected:
  40. CEmitter (const glm::vec3& directions, const glm::vec3& distancemax, const glm::vec3& distancemin, uint32_t id, std::string name,
  41. const glm::vec3& origin, double rate);
  42. private:
  43. /** Direction the particles should move to */
  44. glm::vec3 m_directions;
  45. /** Maximum distance before the particle is dead */
  46. glm::vec3 m_distancemax;
  47. /** Minimum distance before the particle is dead */
  48. glm::vec3 m_distancemin;
  49. /** ID of the emitter */
  50. uint32_t m_id;
  51. /** Name of the emitter, indicates the type of emitter */
  52. std::string m_name;
  53. /** The center of the emitter */
  54. glm::vec3 m_origin;
  55. /** The rate of emission */
  56. double m_rate;
  57. };
  58. } // namespace WallpaperEngine::Core::Objects::Particles