GridEmitterSet2.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_GRID_EMITTER_SET2_HPP
12 #define CUBBYFLOW_GRID_EMITTER_SET2_HPP
13 
15 
16 #include <vector>
17 
18 namespace CubbyFlow
19 {
23 class GridEmitterSet2 final : public GridEmitter2
24 {
25  public:
26  class Builder;
27 
29  GridEmitterSet2() = default;
30 
32  explicit GridEmitterSet2(const std::vector<GridEmitter2Ptr>& emitters);
33 
35  GridEmitterSet2(const GridEmitterSet2&) = default;
36 
38  GridEmitterSet2(GridEmitterSet2&&) noexcept = default;
39 
41  ~GridEmitterSet2() override = default;
42 
44  GridEmitterSet2& operator=(const GridEmitterSet2&) = default;
45 
47  GridEmitterSet2& operator=(GridEmitterSet2&&) noexcept = default;
48 
50  void AddEmitter(const GridEmitter2Ptr& emitter);
51 
53  [[nodiscard]] static Builder GetBuilder();
54 
55  private:
56  void OnUpdate(double currentTimeInSeconds,
57  double timeIntervalInSeconds) override;
58 
59  std::vector<GridEmitter2Ptr> m_emitters;
60 };
61 
63 using GridEmitterSet2Ptr = std::shared_ptr<GridEmitterSet2>;
64 
69 {
70  public:
72  [[nodiscard]] Builder& WithEmitters(
73  const std::vector<GridEmitter2Ptr>& emitters);
74 
76  [[nodiscard]] GridEmitterSet2 Build() const;
77 
79  [[nodiscard]] GridEmitterSet2Ptr MakeShared() const;
80 
81  private:
82  std::vector<GridEmitter2Ptr> m_emitters;
83 };
84 } // namespace CubbyFlow
85 
86 #endif
2-D grid-based emitter set.
Definition: GridEmitterSet2.hpp:23
Abstract base class for 2-D grid-based emitters.
Definition: GridEmitter2.hpp:22
void AddEmitter(const GridEmitter2Ptr &emitter)
Adds sub-emitter.
~GridEmitterSet2() override=default
Default virtual destructor.
std::shared_ptr< GridEmitter2 > GridEmitter2Ptr
Shared pointer type for the GridEmitter2.
Definition: GridEmitter2.hpp:87
Definition: pybind11Utils.hpp:20
static Builder GetBuilder()
Returns builder fox GridEmitterSet2.
Front-end to create GridEmitterSet2 objects step by step.
Definition: GridEmitterSet2.hpp:68
GridEmitterSet2 & operator=(const GridEmitterSet2 &)=default
Default copy assignment operator.
std::shared_ptr< GridEmitterSet2 > GridEmitterSet2Ptr
Shared pointer type for the GridEmitterSet2.
Definition: GridEmitterSet2.hpp:63
GridEmitterSet2()=default
Default constructor.