ParticleEmitterSet2.hpp
Go to the documentation of this file.
1 // This code is based on Jet framework.
2 // Copyright (c) 2018 Doyub Kim
3 // CubbyFlow is voxel-based fluid simulation engine for computer games.
4 // Copyright (c) 2020 CubbyFlow Team
5 // Core Part: Chris Ohk, Junwoo Hwang, Jihong Sin, Seungwoo Yoo
6 // AI Part: Dongheon Cho, Minseo Kim
7 // We are making my contributions/submissions to this project solely in our
8 // personal capacity and are not conveying any rights to any intellectual
9 // property of any third parties.
10 
11 #ifndef CUBBYFLOW_PARTICLE_EMITTER_SET2_HPP
12 #define CUBBYFLOW_PARTICLE_EMITTER_SET2_HPP
13 
15 
16 namespace CubbyFlow
17 {
22 {
23  public:
24  class Builder;
25 
27  ParticleEmitterSet2() = default;
28 
30  explicit ParticleEmitterSet2(std::vector<ParticleEmitter2Ptr> emitters);
31 
33  ParticleEmitterSet2(const ParticleEmitterSet2&) = default;
34 
36  ParticleEmitterSet2(ParticleEmitterSet2&&) noexcept = default;
37 
39  ~ParticleEmitterSet2() override = default;
40 
43 
45  ParticleEmitterSet2& operator=(ParticleEmitterSet2&&) noexcept = default;
46 
48  void AddEmitter(const ParticleEmitter2Ptr& emitter);
49 
51  [[nodiscard]] static Builder GetBuilder();
52 
53  private:
54  std::vector<ParticleEmitter2Ptr> m_emitters;
55 
56  void OnSetTarget(const ParticleSystemData2Ptr& particles) override;
57 
58  void OnUpdate(double currentTimeInSeconds,
59  double timeIntervalInSecond) override;
60 };
61 
63 using ParticleEmitterSet2Ptr = std::shared_ptr<ParticleEmitterSet2>;
64 
69 {
70  public:
72  [[nodiscard]] Builder& WithEmitters(
73  const std::vector<ParticleEmitter2Ptr>& emitters);
74 
76  [[nodiscard]] ParticleEmitterSet2 Build() const;
77 
79  [[nodiscard]] ParticleEmitterSet2Ptr MakeShared() const;
80 
81  private:
82  std::vector<ParticleEmitter2Ptr> m_emitters;
83 };
84 } // namespace CubbyFlow
85 
86 #endif
~ParticleEmitterSet2() override=default
Default virtual destructor.
std::shared_ptr< ParticleEmitter2 > ParticleEmitter2Ptr
Shared pointer for the ParticleEmitter2 type.
Definition: ParticleEmitter2.hpp:94
Front-end to create ParticleEmitterSet2 objects step by step.
Definition: ParticleEmitterSet2.hpp:68
std::shared_ptr< ParticleSystemData2 > ParticleSystemData2Ptr
Shared pointer type of ParticleSystemData2.
Definition: ParticleSystemData.hpp:281
Definition: pybind11Utils.hpp:20
static Builder GetBuilder()
Returns builder fox ParticleEmitterSet2.
std::shared_ptr< ParticleEmitterSet2 > ParticleEmitterSet2Ptr
Shared pointer type for the ParticleEmitterSet2.
Definition: ParticleEmitterSet2.hpp:63
Abstract base class for 2-D particle emitter.
Definition: ParticleEmitter2.hpp:21
void AddEmitter(const ParticleEmitter2Ptr &emitter)
Adds sub-emitter.
2-D particle-based emitter set.
Definition: ParticleEmitterSet2.hpp:21
ParticleEmitterSet2()=default
Default constructor.
ParticleEmitterSet2 & operator=(const ParticleEmitterSet2 &)=default
Default copy assignment operator.