TDME2 1.9.121
ObjectParticleSystem.h
Go to the documentation of this file.
1#pragma once
2
3#include <string>
4#include <vector>
5
6#include <tdme/tdme.h>
14#include <tdme/engine/Entity.h>
17#include <tdme/math/fwd-tdme.h>
19
20using std::string;
21using std::vector;
22
34
35/**
36 * Object particle system entity to be used with engine class
37 * @author Andreas Drewke
38 * @version $Id$
39 */
43{
45
46private:
47 bool frustumCulling { true };
48 Entity* parentEntity { nullptr };
50
51 // overridden methods
52 inline void setParentEntity(Entity* entity) override {
53 this->parentEntity = entity;
54 }
55 inline Entity* getParentEntity() override {
56 return parentEntity;
57 }
58 inline void applyParentTransformations(const Transformations& parentTransformations) override {
60 // TODO: a.drewke, bounding box and emitter needs a update here
61 }
62
63public:
64 /**
65 * Public constructor
66 * @param id id
67 * @param model model
68 * @param scale scale
69 * @param autoEmit auto emit
70 * @param contributesShadows enable contributes shadows
71 * @param receivesShadows enable receives shadows
72 * @param maxCount max count
73 * @param emitter emitter
74 */
75 ObjectParticleSystem(const string& id, Model* model, const Vector3& scale, bool autoEmit, bool contributesShadows, bool receivesShadows, int32_t maxCount, ParticleEmitter* emitter);
76
77 // overridden method
78 inline EntityType getEntityType() override {
80 }
81
82 /**
83 * @return objects
84 */
85 inline const vector<Object3D*>& getObjects() {
86 return objects;
87 }
88
89 /**
90 * @return enabled objects
91 */
92 inline const vector<Object3D*>& getEnabledObjects() {
93 return enabledObjects;
94 }
95
96 void setEngine(Engine* engine) override;
97 void setRenderer(Renderer* renderer) override;
98 void initialize() override;
99 void dispose() override;
100
101 inline bool isEnabled() override {
102 return ObjectParticleSystemInternal::isEnabled();
103 }
104
105 void setEnabled(bool enabled) override;
106 bool isFrustumCulling() override;
107 void setFrustumCulling(bool frustumCulling) override;
108 void fromTransformations(const Transformations& transformations) override;
109 void update() override;
110
111 inline BoundingBox* getBoundingBox() override {
112 return &boundingBox;
113 }
114
117 }
118
119 inline ParticleEmitter* getEmitter() override {
120 return ObjectParticleSystemInternal::getEmitter();
121 }
122
123 inline const Color4& getEffectColorAdd() const override {
124 return ObjectParticleSystemInternal::getEffectColorAdd();
125 }
126
127 inline void setEffectColorAdd(const Color4& effectColorAdd) override {
128 ObjectParticleSystemInternal::setEffectColorAdd(effectColorAdd);
129 }
130
131 inline const Color4& getEffectColorMul() const override {
132 return ObjectParticleSystemInternal::getEffectColorMul();
133 }
134
135 inline void setEffectColorMul(const Color4& effectColorMul) override {
136 ObjectParticleSystemInternal::setEffectColorMul(effectColorMul);
137 }
138
139 inline const string& getId() override {
140 return ObjectParticleSystemInternal::getId();
141 }
142
143 inline bool isContributesShadows() override {
144 return ObjectParticleSystemInternal::isContributesShadows();
145 }
146
147 inline void setContributesShadows(bool contributesShadows) override {
148 ObjectParticleSystemInternal::setContributesShadows(contributesShadows);
149 }
150
151 inline bool isReceivesShadows() override {
152 return ObjectParticleSystemInternal::isReceivesShadows();
153 }
154
155 inline void setReceivesShadows(bool receivesShadows) override {
156 ObjectParticleSystemInternal::setReceivesShadows(receivesShadows);
157 }
158
159 inline bool isPickable() override {
160 return ObjectParticleSystemInternal::isPickable();
161 }
162
163 inline void setPickable(bool pickable) override {
164 ObjectParticleSystemInternal::setPickable(pickable);
165 }
166
167 inline const Vector3& getTranslation() const override {
169 }
170
171 inline void setTranslation(const Vector3& translation) override {
173 }
174
175 inline const Vector3& getScale() const override {
177 }
178
179 inline void setScale(const Vector3& scale) override {
181 }
182
183 inline const Vector3& getPivot() const override {
185 }
186
187 inline void setPivot(const Vector3& pivot) override {
189 }
190
191 inline const int getRotationCount() const override {
193 }
194
195 inline Rotation& getRotation(const int idx) override {
197 }
198
199 inline void addRotation(const Vector3& axis, const float angle) override {
200 Transformations::addRotation(axis, angle);
201 }
202
203 inline void removeRotation(const int idx) override {
205 }
206
207 inline const Vector3& getRotationAxis(const int idx) const override {
209 }
210
211 inline void setRotationAxis(const int idx, const Vector3& axis) override {
213 }
214
215 inline const float getRotationAngle(const int idx) const override {
217 }
218
219 inline void setRotationAngle(const int idx, const float angle) override {
221 }
222
223 inline const Quaternion& getRotationsQuaternion() const override {
225 }
226
227 inline const Matrix4x4& getTransformationsMatrix() const override {
229 }
230
231 inline const Transformations& getTransformations() const override {
232 return *this;
233 }
234
235 inline RenderPass getRenderPass() const override {
236 return renderPass;
237 }
238
239 inline void setRenderPass(RenderPass renderPass) override {
240 this->renderPass = renderPass;
241 }
242
243 inline bool isActive() override {
244 return ObjectParticleSystemInternal::isActive();
245 }
246
247 inline bool isAutoEmit() override {
248 return ObjectParticleSystemInternal::isAutoEmit();
249 }
250
251 inline int32_t emitParticles() override {
252 return ObjectParticleSystemInternal::emitParticles();
253 }
254
255 void setAutoEmit(bool autoEmit) override;
256 void updateParticles() override;
257
258 inline const Transformations& getLocalTransformations() override {
259 return ObjectParticleSystemInternal::getLocalTransformations();
260 }
261 inline void setLocalTransformations(const Transformations& transformations) override {
262 ObjectParticleSystemInternal::setLocalTransformations(transformations);
263 }
264
265};
Engine main class.
Definition: Engine.h:122
TDME engine entity.
Definition: Entity.h:31
@ ENTITYTYPE_OBJECTPARTICLESYSTEM
Definition: Entity.h:70
Object 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
ObjectParticleSystem(const string &id, Model *model, const Vector3 &scale, bool autoEmit, bool contributesShadows, bool receivesShadows, int32_t maxCount, ParticleEmitter *emitter)
Public constructor.
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.
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.
const vector< Object3D * > & getEnabledObjects()
const vector< Object3D * > & getObjects()
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
Particle system group, which combines several particle systems into a group, to be used with engine c...
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
Representation of a 3d model.
Definition: Model.h:32
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.