CParticle.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #pragma once
  2. #include "WallpaperEngine/Core/Objects/Particles/CControlPoint.h"
  3. #include "WallpaperEngine/Core/Objects/Particles/CEmitter.h"
  4. #include "WallpaperEngine/Core/Objects/Particles/CInitializer.h"
  5. #include "WallpaperEngine/Core/CObject.h"
  6. #include "WallpaperEngine/Core/Core.h"
  7. namespace WallpaperEngine::Core::Objects {
  8. using json = nlohmann::json;
  9. /**
  10. * Represents a particle system in the background
  11. */
  12. class CParticle : public CObject {
  13. friend class CObject;
  14. public:
  15. static CParticle* fromFile (CScene* scene, const std::string& filename, CContainer* container,
  16. CUserSettingBoolean* visible, uint32_t id, std::string name,
  17. CUserSettingVector3* origin, CUserSettingVector3* scale);
  18. /**
  19. * @return The list of emitters for the particle system
  20. */
  21. [[nodiscard]] const std::vector<Particles::CEmitter*>& getEmitters () const;
  22. /**
  23. * @return The list of control points for the particle system
  24. */
  25. [[nodiscard]] const std::vector<Particles::CControlPoint*>& getControlPoints () const;
  26. /**
  27. * @return The list of initializers for the particle system
  28. */
  29. [[nodiscard]] const std::vector<Particles::CInitializer*>& getInitializers () const;
  30. protected:
  31. CParticle (CScene* scene, uint32_t starttime, uint32_t maxcount, CUserSettingBoolean* visible, uint32_t id,
  32. std::string name, CUserSettingVector3* origin, CUserSettingVector3* scale);
  33. /**
  34. * @param controlpoint The control point to add to the particle system
  35. */
  36. void insertControlPoint (Particles::CControlPoint* controlpoint);
  37. /**
  38. * @param emitter The emitter to add to the particle system
  39. */
  40. void insertEmitter (Particles::CEmitter* emitter);
  41. /**
  42. * @param initializer The initializer to add to the particle system
  43. */
  44. void insertInitializer (Particles::CInitializer* initializer);
  45. /**
  46. * Type value used to differentiate the different types of objects in a background
  47. */
  48. static const std::string Type;
  49. private:
  50. /** The time at which the particle system should start emitting */
  51. uint32_t m_starttime;
  52. /** Maximum number of particles at the same time */
  53. uint32_t m_maxcount;
  54. /** List of control points */
  55. std::vector<Particles::CControlPoint*> m_controlpoints;
  56. /** List of emitters */
  57. std::vector<Particles::CEmitter*> m_emitters;
  58. /** List of initializers */
  59. std::vector<Particles::CInitializer*> m_initializers;
  60. };
  61. } // namespace WallpaperEngine::Core::Objects