GridEmitterSet2.h
Go to the documentation of this file.
1 /*************************************************************************
2 > File Name: GridEmitterSet2.h
3 > Project Name: CubbyFlow
4 > Author: Chan-Ho Chris Ohk
5 > Purpose: 2-D grid-based emitter set.
6 > Created Time: 2017/08/06
7 > Copyright (c) 2018, Chan-Ho Chris Ohk
8 *************************************************************************/
9 #ifndef CUBBYFLOW_GRID_EMITTER_SET2_H
10 #define CUBBYFLOW_GRID_EMITTER_SET2_H
11 
13 
14 #include <vector>
15 
16 namespace CubbyFlow
17 {
21  class GridEmitterSet2 final : public GridEmitter2
22  {
23  public:
24  class Builder;
25 
28 
30  explicit GridEmitterSet2(const std::vector<GridEmitter2Ptr>& emitters);
31 
33  virtual ~GridEmitterSet2();
34 
36  void AddEmitter(const GridEmitter2Ptr& emitter);
37 
39  static Builder GetBuilder();
40 
41  private:
42  std::vector<GridEmitter2Ptr> m_emitters;
43 
44  void OnUpdate(double currentTimeInSeconds, double timeIntervalInSeconds) override;
45  };
46 
48  using GridEmitterSet2Ptr = std::shared_ptr<GridEmitterSet2>;
49 
54  {
55  public:
57  Builder& WithEmitters(const std::vector<GridEmitter2Ptr>& emitters);
58 
60  GridEmitterSet2 Build() const;
61 
64 
65  private:
66  std::vector<GridEmitter2Ptr> m_emitters;
67  };
68 }
69 
70 #endif
GridEmitterSet2 Build() const
Builds GridEmitterSet2.
2-D grid-based emitter set.
Definition: GridEmitterSet2.h:21
Abstract base class for 2-D grid-based emitters.
Definition: GridEmitter2.h:20
void AddEmitter(const GridEmitter2Ptr &emitter)
Adds sub-emitter.
Builder & WithEmitters(const std::vector< GridEmitter2Ptr > &emitters)
Returns builder with list of sub-emitters.
GridEmitterSet2()
Constructs an emitter.
std::shared_ptr< GridEmitter2 > GridEmitter2Ptr
Shared pointer type for the GridEmitter2.
Definition: GridEmitter2.h:63
Definition: pybind11Utils.h:24
static Builder GetBuilder()
Returns builder fox GridEmitterSet2.
Front-end to create GridEmitterSet2 objects step by step.
Definition: GridEmitterSet2.h:53
std::shared_ptr< GridEmitterSet2 > GridEmitterSet2Ptr
Shared pointer type for the GridEmitterSet2.
Definition: GridEmitterSet2.h:48
virtual ~GridEmitterSet2()
Destructor.
GridEmitterSet2Ptr MakeShared() const
Builds shared pointer of GridEmitterSet2 instance.