CEmitter.h 2.1 KB

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