TDME2 1.9.121
PointsParticleSystem.h
Go to the documentation of this file.
1#pragma once
2
3#include <string>
4
5#include <tdme/tdme.h>
14#include <tdme/engine/Entity.h>
17#include <tdme/math/fwd-tdme.h>
18
19using std::string;
20
32
33/**
34 * Point particle system entity to be used with engine class
35 * @author Andreas Drewke
36 * @version $Id$
37 */
41{
43
44private:
45 bool frustumCulling { true };
46 Entity* parentEntity { nullptr };
48
49 // overridden methods
50 inline void setParentEntity(Entity* entity) override {
51 this->parentEntity = entity;
52 }
53 inline Entity* getParentEntity() override {
54 return parentEntity;
55 }
56 inline void applyParentTransformations(const Transformations& parentTransformations) override {
59 }
60
61public:
62 /**
63 * Public constructor
64 * @param id id
65 * @param emitter emitter
66 * @param maxPoints max points
67 * @param pointSize point size
68 * @param autoEmit auto emit
69 * @param texture texture
70 * @param textureHorizonalSprites texture horizonal sprites
71 * @param textureVerticalSprites texture vertical sprites
72 * @param fps frames per seconds
73 */
74 PointsParticleSystem(const string& id, ParticleEmitter* emitter, int32_t maxPoints, float pointSize, bool autoEmit, Texture* texture = nullptr, int32_t textureHorizontalSprites = 1, int32_t textureVerticalSprites = 1, float fps = 10.0f);
75
76 // overridden methods
77 inline EntityType getEntityType() override {
79 }
80 void setEngine(Engine* engine) override;
81 void setRenderer(Renderer* renderer) override;
82 void initialize() override;
83 void dispose() override;
84
85 inline bool isEnabled() override {
86 return PointsParticleSystemInternal::isEnabled();
87 }
88
89 void setEnabled(bool enabled) override;
90 bool isFrustumCulling() override;
91 void setFrustumCulling(bool frustumCulling) override;
92 void fromTransformations(const Transformations& transformations) override;
93 void update() override;
94
95 inline BoundingBox* getBoundingBox() override {
96 return &boundingBox;
97 }
100 }
101
102 inline ParticleEmitter* getEmitter() override {
103 return PointsParticleSystemInternal::getEmitter();
104 }
105
106 inline const Color4& getEffectColorAdd() const override {
107 return PointsParticleSystemInternal::getEffectColorAdd();
108 }
109
110 inline void setEffectColorAdd(const Color4& effectColorAdd) override {
111 PointsParticleSystemInternal::setEffectColorAdd(effectColorAdd);
112 }
113
114 inline const Color4& getEffectColorMul() const override {
115 return PointsParticleSystemInternal::getEffectColorMul();
116 }
117
118 inline void setEffectColorMul(const Color4& effectColorMul) override {
119 PointsParticleSystemInternal::setEffectColorMul(effectColorMul);
120 }
121
122 inline const string& getId() override {
123 return PointsParticleSystemInternal::getId();
124 }
125
126 inline bool isPickable() override {
127 return PointsParticleSystemInternal::isPickable();
128 }
129
130 inline void setPickable(bool pickable) override {
131 PointsParticleSystemInternal::setPickable(pickable);
132 }
133
134 inline bool isContributesShadows() override {
135 return PointsParticleSystemInternal::isContributesShadows();
136 }
137
138 inline void setContributesShadows(bool contributesShadows) override {
139 PointsParticleSystemInternal::setContributesShadows(contributesShadows);
140 }
141
142 inline bool isReceivesShadows() override {
143 return PointsParticleSystemInternal::isReceivesShadows();
144 }
145
146 inline void setReceivesShadows(bool receivesShadows) override {
147 PointsParticleSystemInternal::setReceivesShadows(receivesShadows);
148 }
149
150 inline const Vector3& getTranslation() const override {
152 }
153
154 inline void setTranslation(const Vector3& translation) override {
156 }
157
158 inline const Vector3& getScale() const override {
160 }
161
162 inline void setScale(const Vector3& scale) override {
164 }
165
166 inline const Vector3& getPivot() const override {
168 }
169
170 inline void setPivot(const Vector3& pivot) override {
172 }
173
174 inline const int getRotationCount() const override {
176 }
177
178 inline Rotation& getRotation(const int idx) override {
180 }
181
182 inline void addRotation(const Vector3& axis, const float angle) override {
183 Transformations::addRotation(axis, angle);
184 }
185
186 inline void removeRotation(const int idx) override {
188 }
189
190 inline const Vector3& getRotationAxis(const int idx) const override {
192 }
193
194 inline void setRotationAxis(const int idx, const Vector3& axis) override {
196 }
197
198 inline const float getRotationAngle(const int idx) const override {
200 }
201
202 inline void setRotationAngle(const int idx, const float angle) override {
204 }
205
206 inline const Quaternion& getRotationsQuaternion() const override {
208 }
209
210 inline const Matrix4x4& getTransformationsMatrix() const override {
212 }
213
214 inline const Transformations& getTransformations() const override {
215 return *this;
216 }
217
218 inline RenderPass getRenderPass() const override {
219 return renderPass;
220 }
221
222 inline void setRenderPass(RenderPass renderPass) override {
223 this->renderPass = renderPass;
224 }
225
226 inline bool isActive() override {
227 return PointsParticleSystemInternal::isActive();
228 }
229
230 inline bool isAutoEmit() override {
231 return PointsParticleSystemInternal::isAutoEmit();
232 }
233
234 inline int32_t emitParticles() override {
235 return PointsParticleSystemInternal::emitParticles();
236 }
237
238 void setAutoEmit(bool autoEmit) override;
239 void updateParticles() override;
240
241 inline const Transformations& getLocalTransformations() override {
242 return PointsParticleSystemInternal::getLocalTransformations();
243 }
244 inline void setLocalTransformations(const Transformations& transformations) override {
245 PointsParticleSystemInternal::setLocalTransformations(transformations);
246 }
247
248};
Engine main class.
Definition: Engine.h:122
TDME engine entity.
Definition: Entity.h:31
@ ENTITYTYPE_POINTSPARTICLESYSTEM
Definition: Entity.h:72
Particle system group, which combines several particle systems into a group, to be used with engine c...
Point particle system entity to be used with engine class.
void updateParticles() override
Updates the particle entity.
const Matrix4x4 & getTransformationsMatrix() const override
const Color4 & getEffectColorAdd() const override
The effect color will be added to fragment color.
ParticleEmitter * getEmitter() override
void setLocalTransformations(const Transformations &transformations) override
Set local transformations.
RenderPass getRenderPass() const override
void dispose() override
Dispose this object 3d.
void setTranslation(const Vector3 &translation) override
Set translation.
void setParentEntity(Entity *entity) override
Set parent entity, needs to be called before adding to engine.
void removeRotation(const int idx) override
Remove rotation.
void setPivot(const Vector3 &pivot) override
Set pivot.
const int getRotationCount() const override
const Quaternion & getRotationsQuaternion() const override
void initialize() override
Initiates this object 3d.
BoundingBox * getBoundingBox() override
void setRenderPass(RenderPass renderPass) override
Set render pass.
void setReceivesShadows(bool receivesShadows) override
Enable/disable receives shadows.
void addRotation(const Vector3 &axis, const float angle) override
Add rotation.
void update() override
Update transformations.
void setPickable(bool pickable) override
Set this object pickable.
const Transformations & getLocalTransformations() override
void setEffectColorMul(const Color4 &effectColorMul) override
Set effect color that will be multiplied with fragment color.
PointsParticleSystem(const string &id, ParticleEmitter *emitter, int32_t maxPoints, float pointSize, bool autoEmit, Texture *texture=nullptr, int32_t textureHorizontalSprites=1, int32_t textureVerticalSprites=1, float fps=10.0f)
Public constructor.
const Vector3 & getTranslation() const override
void fromTransformations(const Transformations &transformations) override
Set up this transformations from given transformations.
const Color4 & getEffectColorMul() const override
The effect color will be multiplied with fragment color.
const Vector3 & getScale() const override
const Vector3 & getPivot() const override
BoundingBox * getBoundingBoxTransformed() override
void setScale(const Vector3 &scale) override
Set scale.
void applyParentTransformations(const Transformations &parentTransformations) override
Apply parent transformations.
const float getRotationAngle(const int idx) const override
const Transformations & getTransformations() const override
void setFrustumCulling(bool frustumCulling) override
Set frustum culling.
void setAutoEmit(bool autoEmit) override
Set auto emit.
void setEngine(Engine *engine) override
Set up engine.
void setEnabled(bool enabled) override
Enable/disable rendering.
const Vector3 & getRotationAxis(const int idx) const override
void setContributesShadows(bool contributesShadows) override
Enable/disable contributes shadows.
void setRotationAxis(const int idx, const Vector3 &axis) override
Set rotation axis.
int32_t emitParticles() override
Adds particles to this particle entity at given position.
Rotation & getRotation(const int idx) override
Get rotation at given index.
void setEffectColorAdd(const Color4 &effectColorAdd) override
Set effect color that will be added to fragment color.
void setRenderer(Renderer *renderer) override
Set up renderer.
void setRotationAngle(const int idx, const float angle) override
Rotation representation.
Definition: Rotation.h:18
Transformations which contain scale, rotations and translation.
const Matrix4x4 & getTransformationsMatrix() const
Rotation & getRotation(const int idx)
Get rotation at given index.
void setRotationAngle(const int idx, const float angle)
void setRotationAxis(const int idx, const Vector3 &axis)
Set rotation axis.
void setTranslation(const Vector3 &translation)
Set translation.
void removeRotation(const int idx)
Remove rotation.
const Quaternion & getRotationsQuaternion() const
virtual void applyParentTransformations(const Transformations &parentTransformations)
Apply parent transformations.
const Vector3 & getScale() const
void setScale(const Vector3 &scale)
Set scale.
const Vector3 & getRotationAxis(const int idx) const
const int getRotationCount() const
const Vector3 & getPivot() const
const Vector3 & getTranslation() const
void setPivot(const Vector3 &pivot)
Set pivot.
void addRotation(const Vector3 &axis, const float angle)
Add rotation.
const float getRotationAngle(const int idx) const
Color 4 definition.
Definition: Color4.h:20
Axis aligned bounding box used for frustum, this is not directly connectable with physics engine.
Definition: BoundingBox.h:25
4x4 3D Matrix class
Definition: Matrix4x4.h:24
Quaternion class.
Definition: Quaternion.h:22
3D vector 3 class
Definition: Vector3.h:22
Particle system entity interface.