ParticleEmitter3.h
Go to the documentation of this file.
1 /*************************************************************************
2 > File Name: ParticleEmitter3.h
3 > Project Name: CubbyFlow
4 > Author: Chan-Ho Chris Ohk
5 > Purpose: Abstract base class for 3-D particle emitter.
6 > Created Time: 2017/05/10
7 > Copyright (c) 2018, Chan-Ho Chris Ohk
8 *************************************************************************/
9 #ifndef CUBBYFLOW_PARTICLE_EMITTER3_H
10 #define CUBBYFLOW_PARTICLE_EMITTER3_H
11 
13 
14 namespace CubbyFlow
15 {
20  {
21  public:
28  using OnBeginUpdateCallback = std::function<void(ParticleEmitter3*, double, double)>;
29 
32 
34  virtual ~ParticleEmitter3();
35 
38  void Update(double currentTimeInSeconds, double timeIntervalInSeconds);
39 
41  const ParticleSystemData3Ptr& GetTarget() const;
42 
44  void SetTarget(const ParticleSystemData3Ptr& particles);
45 
56  void SetOnBeginUpdateCallback(const OnBeginUpdateCallback& callback);
57 
58  protected:
60  virtual void OnSetTarget(const ParticleSystemData3Ptr& particles);
61 
63  virtual void OnUpdate(double currentTimeInSeconds, double timeIntervalInSeconds) = 0;
64 
65  private:
66  ParticleSystemData3Ptr m_particles;
67  OnBeginUpdateCallback m_onBeginUpdateCallback;
68  };
69 
71  using ParticleEmitter3Ptr = std::shared_ptr<ParticleEmitter3>;
72 }
73 
74 #endif
std::function< void(ParticleEmitter3 *, double, double)> OnBeginUpdateCallback
Callback function type for update calls.
Definition: ParticleEmitter3.h:28
Abstract base class for 3-D particle emitter.
Definition: ParticleEmitter3.h:19
std::shared_ptr< ParticleEmitter3 > ParticleEmitter3Ptr
Shared pointer for the ParticleEmitter3 type.
Definition: ParticleEmitter3.h:71
virtual void OnUpdate(double currentTimeInSeconds, double timeIntervalInSeconds)=0
Called when ParticleEmitter3::Update is executed.
std::shared_ptr< ParticleSystemData3 > ParticleSystemData3Ptr
Shared pointer type of ParticleSystemData3.
Definition: ParticleSystemData3.h:250
const ParticleSystemData3Ptr & GetTarget() const
Returns the target particle system to emit.
void Update(double currentTimeInSeconds, double timeIntervalInSeconds)
void SetOnBeginUpdateCallback(const OnBeginUpdateCallback &callback)
Sets the callback function to be called when ParticleEmitter3::Update function is invoked...
virtual ~ParticleEmitter3()
Destructor.
Definition: pybind11Utils.h:24
void SetTarget(const ParticleSystemData3Ptr &particles)
Sets the target particle system to emit.
ParticleEmitter3()
Default constructor.
virtual void OnSetTarget(const ParticleSystemData3Ptr &particles)
Called when ParticleEmitter3::SetTarget is executed.