TDME2  1.9.200
BoundingBoxParticleEmitter.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>
8 #include <tdme/engine/Color4.h>
12 #include <tdme/math/fwd-tdme.h>
13 #include <tdme/math/Vector3.h>
14 
15 using std::unique_ptr;
16 
23 
24 /**
25  * Bounding box particle emitter
26  * @author Andreas Drewke
27  */
29  : public ParticleEmitter
30 {
31 private:
32  int32_t count;
33  int64_t lifeTime;
34  int64_t lifeTimeRnd;
35  float mass;
36  float massRnd;
37  unique_ptr<OrientedBoundingBox> obb;
38  unique_ptr<OrientedBoundingBox> worldObb;
43 
44 public:
45  // forbid class copy
47 
48  /**
49  * Public constructor
50  * @param count particles to emit in one second
51  * @param lifeTime life time in milli seconds
52  * @param lifeTimeRnd life time rnd in milli seconds
53  * @param mass mass in kg
54  * @param massRnd mass rnd in kg
55  * @param obb oriented bounding box
56  * @param velocity velocity in meter / seconds
57  * @param velocityRnd velocity rnd in meter / seconds
58  * @param colorStart color start
59  * @param colorEnd color end
60  */
62 
63  /**
64  * Destructor
65  */
67 
68  // overridden methods
69  inline const Vector3& getCenter() const override {
70  return worldObb->getCenter();
71  }
72 
73  inline int32_t getCount() const override {
74  return count;
75  }
76 
77  inline const Vector3& getVelocity() const {
78  return velocity;
79  }
80 
81  inline const Vector3& getVelocityRnd() const {
82  return velocityRnd;
83  }
84 
85  inline const Color4& getColorStart() const override {
86  return colorStart;
87  }
88 
89  inline void setColorStart(const Color4& colorStart) override {
90  this->colorStart = colorStart;
91  }
92 
93  inline const Color4& getColorEnd() const override {
94  return colorEnd;
95  }
96 
97  inline void setColorEnd(const Color4& colorEnd) override {
98  this->colorEnd = colorEnd;
99  }
100 
101  void emit(Particle* particle) override;
102  void setTransform(const Transform& transform) override;
103 
104 };
Color 4 definition class.
Definition: Color4.h:18
Transform which contain scale, rotations and translation.
Definition: Transform.h:29
Oriented bounding box physics primitive.
void setColorEnd(const Color4 &colorEnd) override
Set end color.
void setColorStart(const Color4 &colorStart) override
Set start color.
BoundingBoxParticleEmitter(int32_t count, int64_t lifeTime, int64_t lifeTimeRnd, float mass, float massRnd, OrientedBoundingBox *obb, const Vector3 &velocity, const Vector3 &velocityRnd, const Color4 &colorStart, const Color4 &colorEnd)
Public constructor.
void setTransform(const Transform &transform) override
Update transform with given transform.
Vector3 class representing vector3 mathematical structure and operations with x, y,...
Definition: Vector3.h:20
#define FORBID_CLASS_COPY(CLASS)
Definition: tdme.h:6