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