TDME2  1.9.200
SphereParticleEmitter.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <memory>
4 
5 #include <tdme/tdme.h>
6 #include <tdme/engine/fwd-tdme.h>
11 #include <tdme/math/fwd-tdme.h>
12 #include <tdme/math/Vector3.h>
13 
14 using std::unique_ptr;
15 
22 
23 /**
24  * Sphere particle emitter
25  * @author Andreas Drewke
26  */
28  : public ParticleEmitter
29 {
30 private:
31  int32_t count;
32  int64_t lifeTime;
33  int64_t lifeTimeRnd;
34  float mass;
35  float massRnd;
36  unique_ptr<Sphere> sphere;
37  unique_ptr<Sphere> worldSphere;
42 
43 public:
44  // forbid class copy
46 
47  /**
48  * @param count number of particles to emit in one second
49  * @param lifeTime life time in milli seconds
50  * @param lifeTimeRnd life time rnd in milli seconds
51  * @param mass mass in kg
52  * @param massRnd mass rnd in kg
53  * @param sphere sphere
54  * @param velocity velocity in meter / seconds
55  * @param velocityRnd velocity rnd in meter / seconds
56  * @param colorStart color start
57  * @param colorEnd color end
58  */
59  SphereParticleEmitter(int32_t count, int64_t lifeTime, int64_t lifeTimeRnd, float mass, float massRnd, Sphere* sphere, const Vector3& velocity, const Vector3& velocityRnd, const Color4& colorStart, const Color4& colorEnd);
60 
61  /**
62  * Destructor
63  */
64  virtual ~SphereParticleEmitter();
65 
66  // overridden methods
67  inline const Vector3& getCenter() const override {
68  return worldSphere->getCenter();
69  }
70 
71  inline int32_t getCount() const override {
72  return count;
73  }
74 
75  inline const Vector3& getVelocity() const {
76  return velocity;
77  }
78 
79  inline const Vector3& getVelocityRnd() const {
80  return velocityRnd;
81  }
82 
83  inline const Color4& getColorStart() const override {
84  return colorStart;
85  }
86 
87  inline void setColorStart(const Color4& colorStart) override {
88  this->colorStart = colorStart;
89  }
90 
91  inline const Color4& getColorEnd() const override {
92  return colorEnd;
93  }
94 
95  inline void setColorEnd(const Color4& colorEnd) override {
96  this->colorEnd = colorEnd;
97  }
98 
99  void emit(Particle* particle) override;
100  void setTransform(const Transform& transform) override;
101 
102 };
Color 4 definition class.
Definition: Color4.h:18
Transform which contain scale, rotations and translation.
Definition: Transform.h:29
Sphere physics primitive.
Definition: Sphere.h:19
void setColorEnd(const Color4 &colorEnd) override
Set end color.
void setColorStart(const Color4 &colorStart) override
Set start color.
void setTransform(const Transform &transform) override
Update transform with given transform.
void emit(Particle *particle) override
Emits particles.
SphereParticleEmitter(int32_t count, int64_t lifeTime, int64_t lifeTimeRnd, float mass, float massRnd, Sphere *sphere, const Vector3 &velocity, const Vector3 &velocityRnd, const Color4 &colorStart, const Color4 &colorEnd)
Vector3 class representing vector3 mathematical structure and operations with x, y,...
Definition: Vector3.h:20
#define FORBID_CLASS_COPY(CLASS)
Definition: tdme.h:6