1 // Copyright (C) 2002-2012 Nikolaus Gebhardt
\r
2 // This file is part of the "Irrlicht Engine".
\r
3 // For conditions of distribution and use, see copyright notice in irrlicht.h
\r
5 #ifndef __I_PARTICLE_SYSTEM_SCENE_NODE_H_INCLUDED__
\r
6 #define __I_PARTICLE_SYSTEM_SCENE_NODE_H_INCLUDED__
\r
8 #include "ISceneNode.h"
\r
9 #include "IParticleAnimatedMeshSceneNodeEmitter.h"
\r
10 #include "IParticleBoxEmitter.h"
\r
11 #include "IParticleCylinderEmitter.h"
\r
12 #include "IParticleMeshEmitter.h"
\r
13 #include "IParticleRingEmitter.h"
\r
14 #include "IParticleSphereEmitter.h"
\r
15 #include "IParticleAttractionAffector.h"
\r
16 #include "IParticleFadeOutAffector.h"
\r
17 #include "IParticleGravityAffector.h"
\r
18 #include "IParticleRotationAffector.h"
\r
19 #include "dimension2d.h"
\r
26 //! A particle system scene node for creating snow, fire, explosions, smoke...
\r
27 /** A scene node controlling a particle System. The behavior of the particles
\r
28 can be controlled by setting the right particle emitters and affectors.
\r
29 You can for example easily create a campfire by doing this:
\r
32 scene::IParticleSystemSceneNode* p = scenemgr->addParticleSystemSceneNode();
\r
33 p->setParticleSize(core::dimension2d<f32>(20.0f, 10.0f));
\r
34 scene::IParticleEmitter* em = p->createBoxEmitter(
\r
35 core::aabbox3d<f32>(-5,0,-5,5,1,5),
\r
36 core::vector3df(0.0f,0.03f,0.0f),
\r
37 40,80, video::SColor(0,255,255,255),video::SColor(0,255,255,255), 1100,2000);
\r
40 scene::IParticleAffector* paf = p->createFadeOutParticleAffector();
\r
41 p->addAffector(paf);
\r
46 //! Bitflags to control particle behavior
\r
47 enum EParticleBehavior
\r
49 //! Continue emitting new particles even when the node is invisible
\r
50 EPB_INVISIBLE_EMITTING = 1,
\r
52 //! Continue affecting particles even when the node is invisible
\r
53 EPB_INVISIBLE_AFFECTING = 2,
\r
55 //! Continue updating particle positions or deleting them even when the node is invisible
\r
56 EPB_INVISIBLE_ANIMATING = 4,
\r
58 //! Clear all particles when node gets invisible
\r
59 EPB_CLEAR_ON_INVISIBLE = 8,
\r
61 //! Particle movement direction on emitting ignores the node rotation
\r
62 //! This is mainly to allow backward compatible behavior to Irrlicht 1.8
\r
63 EPB_EMITTER_VECTOR_IGNORE_ROTATION = 16,
\r
65 //! On emitting global particles interpolate the positions randomly between the last and current node transformations.
\r
66 //! This can be set to avoid gaps caused by fast node movement or low framerates, but will be somewhat
\r
67 //! slower to calculate.
\r
68 EPB_EMITTER_FRAME_INTERPOLATION = 32
\r
71 class IParticleSystemSceneNode : public ISceneNode
\r
76 IParticleSystemSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
\r
77 const core::vector3df& position = core::vector3df(0,0,0),
\r
78 const core::vector3df& rotation = core::vector3df(0,0,0),
\r
79 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f))
\r
80 : ISceneNode(parent, mgr, id, position, rotation, scale)
\r
81 , ParticleBehavior(0)
\r
85 //! Sets the size of all particles.
\r
86 virtual void setParticleSize(
\r
87 const core::dimension2d<f32> &size = core::dimension2d<f32>(5.0f, 5.0f)) = 0;
\r
89 //! Sets if the particles should be global.
\r
90 /** If they are, the particles are affected by the movement of the
\r
91 particle system scene node too, otherwise they completely ignore it.
\r
93 virtual void setParticlesAreGlobal(bool global=true) = 0;
\r
96 //! Bitflags to change the particle behavior
\r
98 \param flags A combination of ::EParticleBehavior bit-flags. Default is 0. */
\r
99 virtual void setParticleBehavior(irr::u32 flags)
\r
101 ParticleBehavior = flags;
\r
105 //! Gets how particles behave in different situations
\r
107 \return A combination of ::EParticleBehavior flags */
\r
108 virtual irr::u32 getParticleBehavior() const
\r
110 return ParticleBehavior;
\r
113 //! Remove all currently visible particles
\r
114 virtual void clearParticles() = 0;
\r
116 //! Do manually update the particles.
\r
117 /** This should only be called when you want to render the node outside
\r
118 the scenegraph, as the node will care about this otherwise
\r
120 virtual void doParticleSystem(u32 time) = 0;
\r
122 //! Gets the particle emitter, which creates the particles.
\r
123 /** \return The particle emitter. Can be 0 if none is set. */
\r
124 virtual IParticleEmitter* getEmitter() =0;
\r
126 //! Sets the particle emitter, which creates the particles.
\r
127 /** A particle emitter can be created using one of the createEmitter
\r
128 methods. For example to create and use a simple PointEmitter, call
\r
129 IParticleEmitter* p = createPointEmitter(); setEmitter(p); p->drop();
\r
130 \param emitter: Sets the particle emitter. You can set this to 0 for
\r
131 removing the current emitter and stopping the particle system emitting
\r
133 virtual void setEmitter(IParticleEmitter* emitter) = 0;
\r
135 //! Adds new particle effector to the particle system.
\r
136 /** A particle affector modifies the particles. For example, the FadeOut
\r
137 affector lets all particles fade out after some time. It is created and
\r
140 IParticleAffector* p = createFadeOutParticleAffector();
\r
144 Please note that an affector is not necessary for the particle system to
\r
146 \param affector: New affector. */
\r
147 virtual void addAffector(IParticleAffector* affector) = 0;
\r
149 //! Get a list of all particle affectors.
\r
150 /** \return The list of particle affectors attached to this node. */
\r
151 virtual const core::list<IParticleAffector*>& getAffectors() const = 0;
\r
153 //! Removes all particle affectors in the particle system.
\r
154 virtual void removeAllAffectors() = 0;
\r
156 //! Creates a particle emitter for an animated mesh scene node
\r
157 /** \param node: Pointer to the animated mesh scene node to emit
\r
159 \param useNormalDirection: If true, the direction of each particle
\r
160 created will be the normal of the vertex that it's emitting from. The
\r
161 normal is divided by the normalDirectionModifier parameter, which
\r
162 defaults to 100.0f.
\r
163 \param direction: Direction and speed of particle emission.
\r
164 \param normalDirectionModifier: If the emitter is using the normal
\r
165 direction then the normal of the vertex that is being emitted from is
\r
166 divided by this number.
\r
167 \param mbNumber: This allows you to specify a specific meshBuffer for
\r
168 the IMesh* to emit particles from. The default value is -1, which
\r
169 means a random meshBuffer picked from all of the meshes meshBuffers
\r
170 will be selected to pick a random vertex from. If the value is 0 or
\r
171 greater, it will only pick random vertices from the meshBuffer
\r
172 specified by this value.
\r
173 \param everyMeshVertex: If true, the emitter will emit between min/max
\r
174 particles every second, for every vertex in the mesh, if false, it will
\r
175 emit between min/max particles from random vertices in the mesh.
\r
176 \param minParticlesPerSecond: Minimal amount of particles emitted per
\r
178 \param maxParticlesPerSecond: Maximal amount of particles emitted per
\r
180 \param minStartColor: Minimal initial start color of a particle. The
\r
181 real color of every particle is calculated as random interpolation
\r
182 between minStartColor and maxStartColor.
\r
183 \param maxStartColor: Maximal initial start color of a particle. The
\r
184 real color of every particle is calculated as random interpolation
\r
185 between minStartColor and maxStartColor.
\r
186 \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
\r
187 \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
\r
188 \param maxAngleDegrees: Maximal angle in degrees, the emitting
\r
189 direction of the particle will differ from the original direction.
\r
190 \param minStartSize: Minimal initial start size of a particle. The
\r
191 real size of every particle is calculated as random interpolation
\r
192 between minStartSize and maxStartSize.
\r
193 \param maxStartSize: Maximal initial start size of a particle. The
\r
194 real size of every particle is calculated as random interpolation
\r
195 between minStartSize and maxStartSize.
\r
196 \return Pointer to the created particle emitter. To set this emitter
\r
197 as new emitter of this particle system, just call setEmitter(). Note
\r
198 that you'll have to drop() the returned pointer, after you don't need
\r
199 it any more, see IReferenceCounted::drop() for more information. */
\r
200 virtual IParticleAnimatedMeshSceneNodeEmitter* createAnimatedMeshSceneNodeEmitter(
\r
201 scene::IAnimatedMeshSceneNode* node, bool useNormalDirection = true,
\r
202 const core::vector3df& direction = core::vector3df(0.0f,0.03f,0.0f),
\r
203 f32 normalDirectionModifier = 100.0f, s32 mbNumber = -1,
\r
204 bool everyMeshVertex = false,
\r
205 u32 minParticlesPerSecond = 5, u32 maxParticlesPerSecond = 10,
\r
206 const video::SColor& minStartColor = video::SColor(255,0,0,0),
\r
207 const video::SColor& maxStartColor = video::SColor(255,255,255,255),
\r
208 u32 lifeTimeMin = 2000, u32 lifeTimeMax = 4000,
\r
209 s32 maxAngleDegrees = 0,
\r
210 const core::dimension2df& minStartSize = core::dimension2df(5.0f,5.0f),
\r
211 const core::dimension2df& maxStartSize = core::dimension2df(5.0f,5.0f) ) = 0;
\r
213 //! Creates a box particle emitter.
\r
214 /** \param box: The box for the emitter.
\r
215 \param direction: Direction and speed of particle emission.
\r
216 \param minParticlesPerSecond: Minimal amount of particles emitted per
\r
218 \param maxParticlesPerSecond: Maximal amount of particles emitted per
\r
220 \param minStartColor: Minimal initial start color of a particle. The
\r
221 real color of every particle is calculated as random interpolation
\r
222 between minStartColor and maxStartColor.
\r
223 \param maxStartColor: Maximal initial start color of a particle. The
\r
224 real color of every particle is calculated as random interpolation
\r
225 between minStartColor and maxStartColor.
\r
226 \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
\r
227 \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
\r
228 \param maxAngleDegrees: Maximal angle in degrees, the emitting
\r
229 direction of the particle will differ from the original direction.
\r
230 \param minStartSize: Minimal initial start size of a particle. The
\r
231 real size of every particle is calculated as random interpolation
\r
232 between minStartSize and maxStartSize.
\r
233 \param maxStartSize: Maximal initial start size of a particle. The
\r
234 real size of every particle is calculated as random interpolation
\r
235 between minStartSize and maxStartSize.
\r
236 \return Pointer to the created particle emitter. To set this emitter
\r
237 as new emitter of this particle system, just call setEmitter(). Note
\r
238 that you'll have to drop() the returned pointer, after you don't need
\r
239 it any more, see IReferenceCounted::drop() for more information. */
\r
240 virtual IParticleBoxEmitter* createBoxEmitter(
\r
241 const core::aabbox3df& box = core::aabbox3df(-10,28,-10,10,30,10),
\r
242 const core::vector3df& direction = core::vector3df(0.0f,0.03f,0.0f),
\r
243 u32 minParticlesPerSecond = 5,
\r
244 u32 maxParticlesPerSecond = 10,
\r
245 const video::SColor& minStartColor = video::SColor(255,0,0,0),
\r
246 const video::SColor& maxStartColor = video::SColor(255,255,255,255),
\r
247 u32 lifeTimeMin=2000, u32 lifeTimeMax=4000,
\r
248 s32 maxAngleDegrees=0,
\r
249 const core::dimension2df& minStartSize = core::dimension2df(5.0f,5.0f),
\r
250 const core::dimension2df& maxStartSize = core::dimension2df(5.0f,5.0f) ) = 0;
\r
252 //! Creates a particle emitter for emitting from a cylinder
\r
253 /** \param center: The center of the circle at the base of the cylinder
\r
254 \param radius: The thickness of the cylinder
\r
255 \param normal: Direction of the length of the cylinder
\r
256 \param length: The length of the the cylinder
\r
257 \param outlineOnly: Whether or not to put points inside the cylinder or
\r
258 on the outline only
\r
259 \param direction: Direction and speed of particle emission.
\r
260 \param minParticlesPerSecond: Minimal amount of particles emitted per
\r
262 \param maxParticlesPerSecond: Maximal amount of particles emitted per
\r
264 \param minStartColor: Minimal initial start color of a particle. The
\r
265 real color of every particle is calculated as random interpolation
\r
266 between minStartColor and maxStartColor.
\r
267 \param maxStartColor: Maximal initial start color of a particle. The
\r
268 real color of every particle is calculated as random interpolation
\r
269 between minStartColor and maxStartColor.
\r
270 \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
\r
271 \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
\r
272 \param maxAngleDegrees: Maximal angle in degrees, the emitting
\r
273 direction of the particle will differ from the original direction.
\r
274 \param minStartSize: Minimal initial start size of a particle. The
\r
275 real size of every particle is calculated as random interpolation
\r
276 between minStartSize and maxStartSize.
\r
277 \param maxStartSize: Maximal initial start size of a particle. The
\r
278 real size of every particle is calculated as random interpolation
\r
279 between minStartSize and maxStartSize.
\r
280 \return Pointer to the created particle emitter. To set this emitter
\r
281 as new emitter of this particle system, just call setEmitter(). Note
\r
282 that you'll have to drop() the returned pointer, after you don't need
\r
283 it any more, see IReferenceCounted::drop() for more information. */
\r
284 virtual IParticleCylinderEmitter* createCylinderEmitter(
\r
285 const core::vector3df& center, f32 radius,
\r
286 const core::vector3df& normal, f32 length,
\r
287 bool outlineOnly = false,
\r
288 const core::vector3df& direction = core::vector3df(0.0f,0.03f,0.0f),
\r
289 u32 minParticlesPerSecond = 5, u32 maxParticlesPerSecond = 10,
\r
290 const video::SColor& minStartColor = video::SColor(255,0,0,0),
\r
291 const video::SColor& maxStartColor = video::SColor(255,255,255,255),
\r
292 u32 lifeTimeMin = 2000, u32 lifeTimeMax = 4000,
\r
293 s32 maxAngleDegrees = 0,
\r
294 const core::dimension2df& minStartSize = core::dimension2df(5.0f,5.0f),
\r
295 const core::dimension2df& maxStartSize = core::dimension2df(5.0f,5.0f) ) = 0;
\r
297 //! Creates a mesh particle emitter.
\r
298 /** \param mesh: Pointer to mesh to emit particles from
\r
299 \param useNormalDirection: If true, the direction of each particle
\r
300 created will be the normal of the vertex that it's emitting from. The
\r
301 normal is divided by the normalDirectionModifier parameter, which
\r
302 defaults to 100.0f.
\r
303 \param direction: Direction and speed of particle emission.
\r
304 \param normalDirectionModifier: If the emitter is using the normal
\r
305 direction then the normal of the vertex that is being emitted from is
\r
306 divided by this number.
\r
307 \param mbNumber: This allows you to specify a specific meshBuffer for
\r
308 the IMesh* to emit particles from. The default value is -1, which
\r
309 means a random meshBuffer picked from all of the meshes meshBuffers
\r
310 will be selected to pick a random vertex from. If the value is 0 or
\r
311 greater, it will only pick random vertices from the meshBuffer
\r
312 specified by this value.
\r
313 \param everyMeshVertex: If true, the emitter will emit between min/max
\r
314 particles every second, for every vertex in the mesh, if false, it will
\r
315 emit between min/max particles from random vertices in the mesh.
\r
316 \param minParticlesPerSecond: Minimal amount of particles emitted per
\r
318 \param maxParticlesPerSecond: Maximal amount of particles emitted per
\r
320 \param minStartColor: Minimal initial start color of a particle. The
\r
321 real color of every particle is calculated as random interpolation
\r
322 between minStartColor and maxStartColor.
\r
323 \param maxStartColor: Maximal initial start color of a particle. The
\r
324 real color of every particle is calculated as random interpolation
\r
325 between minStartColor and maxStartColor.
\r
326 \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
\r
327 \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
\r
328 \param maxAngleDegrees: Maximal angle in degrees, the emitting
\r
329 direction of the particle will differ from the original direction.
\r
330 \param minStartSize: Minimal initial start size of a particle. The
\r
331 real size of every particle is calculated as random interpolation
\r
332 between minStartSize and maxStartSize.
\r
333 \param maxStartSize: Maximal initial start size of a particle. The
\r
334 real size of every particle is calculated as random interpolation
\r
335 between minStartSize and maxStartSize.
\r
336 \return Pointer to the created particle emitter. To set this emitter
\r
337 as new emitter of this particle system, just call setEmitter(). Note
\r
338 that you'll have to drop() the returned pointer, after you don't need
\r
339 it any more, see IReferenceCounted::drop() for more information. */
\r
340 virtual IParticleMeshEmitter* createMeshEmitter(
\r
341 scene::IMesh* mesh, bool useNormalDirection = true,
\r
342 const core::vector3df& direction = core::vector3df(0.0f,0.03f,0.0f),
\r
343 f32 normalDirectionModifier = 100.0f, s32 mbNumber = -1,
\r
344 bool everyMeshVertex = false,
\r
345 u32 minParticlesPerSecond = 5, u32 maxParticlesPerSecond = 10,
\r
346 const video::SColor& minStartColor = video::SColor(255,0,0,0),
\r
347 const video::SColor& maxStartColor = video::SColor(255,255,255,255),
\r
348 u32 lifeTimeMin = 2000, u32 lifeTimeMax = 4000,
\r
349 s32 maxAngleDegrees = 0,
\r
350 const core::dimension2df& minStartSize = core::dimension2df(5.0f,5.0f),
\r
351 const core::dimension2df& maxStartSize = core::dimension2df(5.0f,5.0f) ) = 0;
\r
353 //! Creates a point particle emitter.
\r
354 /** \param direction: Direction and speed of particle emission.
\r
355 \param minParticlesPerSecond: Minimal amount of particles emitted per
\r
357 \param maxParticlesPerSecond: Maximal amount of particles emitted per
\r
359 \param minStartColor: Minimal initial start color of a particle. The
\r
360 real color of every particle is calculated as random interpolation
\r
361 between minStartColor and maxStartColor.
\r
362 \param maxStartColor: Maximal initial start color of a particle. The
\r
363 real color of every particle is calculated as random interpolation
\r
364 between minStartColor and maxStartColor.
\r
365 \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
\r
366 \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
\r
367 \param maxAngleDegrees: Maximal angle in degrees, the emitting
\r
368 direction of the particle will differ from the original direction.
\r
369 \param minStartSize: Minimal initial start size of a particle. The
\r
370 real size of every particle is calculated as random interpolation
\r
371 between minStartSize and maxStartSize.
\r
372 \param maxStartSize: Maximal initial start size of a particle. The
\r
373 real size of every particle is calculated as random interpolation
\r
374 between minStartSize and maxStartSize.
\r
375 \return Pointer to the created particle emitter. To set this emitter
\r
376 as new emitter of this particle system, just call setEmitter(). Note
\r
377 that you'll have to drop() the returned pointer, after you don't need
\r
378 it any more, see IReferenceCounted::drop() for more information. */
\r
379 virtual IParticlePointEmitter* createPointEmitter(
\r
380 const core::vector3df& direction = core::vector3df(0.0f,0.03f,0.0f),
\r
381 u32 minParticlesPerSecond = 5,
\r
382 u32 maxParticlesPerSecond = 10,
\r
383 const video::SColor& minStartColor = video::SColor(255,0,0,0),
\r
384 const video::SColor& maxStartColor = video::SColor(255,255,255,255),
\r
385 u32 lifeTimeMin=2000, u32 lifeTimeMax=4000,
\r
386 s32 maxAngleDegrees=0,
\r
387 const core::dimension2df& minStartSize = core::dimension2df(5.0f,5.0f),
\r
388 const core::dimension2df& maxStartSize = core::dimension2df(5.0f,5.0f) ) = 0;
\r
390 //! Creates a ring particle emitter.
\r
391 /** \param center: Center of ring
\r
392 \param radius: Distance of points from center, points will be rotated
\r
393 around the Y axis at a random 360 degrees and will then be shifted by
\r
394 the provided ringThickness values in each axis.
\r
395 \param ringThickness : thickness of the ring or how wide the ring is
\r
396 \param direction: Direction and speed of particle emission.
\r
397 \param minParticlesPerSecond: Minimal amount of particles emitted per
\r
399 \param maxParticlesPerSecond: Maximal amount of particles emitted per
\r
401 \param minStartColor: Minimal initial start color of a particle. The
\r
402 real color of every particle is calculated as random interpolation
\r
403 between minStartColor and maxStartColor.
\r
404 \param maxStartColor: Maximal initial start color of a particle. The
\r
405 real color of every particle is calculated as random interpolation
\r
406 between minStartColor and maxStartColor.
\r
407 \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
\r
408 \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
\r
409 \param maxAngleDegrees: Maximal angle in degrees, the emitting
\r
410 direction of the particle will differ from the original direction.
\r
411 \param minStartSize: Minimal initial start size of a particle. The
\r
412 real size of every particle is calculated as random interpolation
\r
413 between minStartSize and maxStartSize.
\r
414 \param maxStartSize: Maximal initial start size of a particle. The
\r
415 real size of every particle is calculated as random interpolation
\r
416 between minStartSize and maxStartSize.
\r
417 \return Pointer to the created particle emitter. To set this emitter
\r
418 as new emitter of this particle system, just call setEmitter(). Note
\r
419 that you'll have to drop() the returned pointer, after you don't need
\r
420 it any more, see IReferenceCounted::drop() for more information. */
\r
421 virtual IParticleRingEmitter* createRingEmitter(
\r
422 const core::vector3df& center, f32 radius, f32 ringThickness,
\r
423 const core::vector3df& direction = core::vector3df(0.0f,0.03f,0.0f),
\r
424 u32 minParticlesPerSecond = 5,
\r
425 u32 maxParticlesPerSecond = 10,
\r
426 const video::SColor& minStartColor = video::SColor(255,0,0,0),
\r
427 const video::SColor& maxStartColor = video::SColor(255,255,255,255),
\r
428 u32 lifeTimeMin=2000, u32 lifeTimeMax=4000,
\r
429 s32 maxAngleDegrees=0,
\r
430 const core::dimension2df& minStartSize = core::dimension2df(5.0f,5.0f),
\r
431 const core::dimension2df& maxStartSize = core::dimension2df(5.0f,5.0f) ) = 0;
\r
433 //! Creates a sphere particle emitter.
\r
434 /** \param center: Center of sphere
\r
435 \param radius: Radius of sphere
\r
436 \param direction: Direction and speed of particle emission.
\r
437 \param minParticlesPerSecond: Minimal amount of particles emitted per
\r
439 \param maxParticlesPerSecond: Maximal amount of particles emitted per
\r
441 \param minStartColor: Minimal initial start color of a particle. The
\r
442 real color of every particle is calculated as random interpolation
\r
443 between minStartColor and maxStartColor.
\r
444 \param maxStartColor: Maximal initial start color of a particle. The
\r
445 real color of every particle is calculated as random interpolation
\r
446 between minStartColor and maxStartColor.
\r
447 \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
\r
448 \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
\r
449 \param maxAngleDegrees: Maximal angle in degrees, the emitting
\r
450 direction of the particle will differ from the original direction.
\r
451 \param minStartSize: Minimal initial start size of a particle. The
\r
452 real size of every particle is calculated as random interpolation
\r
453 between minStartSize and maxStartSize.
\r
454 \param maxStartSize: Maximal initial start size of a particle. The
\r
455 real size of every particle is calculated as random interpolation
\r
456 between minStartSize and maxStartSize.
\r
457 \return Pointer to the created particle emitter. To set this emitter
\r
458 as new emitter of this particle system, just call setEmitter(). Note
\r
459 that you'll have to drop() the returned pointer, after you don't need
\r
460 it any more, see IReferenceCounted::drop() for more information. */
\r
461 virtual IParticleSphereEmitter* createSphereEmitter(
\r
462 const core::vector3df& center, f32 radius,
\r
463 const core::vector3df& direction = core::vector3df(0.0f,0.03f,0.0f),
\r
464 u32 minParticlesPerSecond = 5,
\r
465 u32 maxParticlesPerSecond = 10,
\r
466 const video::SColor& minStartColor = video::SColor(255,0,0,0),
\r
467 const video::SColor& maxStartColor = video::SColor(255,255,255,255),
\r
468 u32 lifeTimeMin=2000, u32 lifeTimeMax=4000,
\r
469 s32 maxAngleDegrees=0,
\r
470 const core::dimension2df& minStartSize = core::dimension2df(5.0f,5.0f),
\r
471 const core::dimension2df& maxStartSize = core::dimension2df(5.0f,5.0f) ) = 0;
\r
473 //! Creates a point attraction affector.
\r
474 /** This affector modifies the positions of the particles and attracts
\r
475 them to a specified point at a specified speed per second.
\r
476 \param point: Point to attract particles to.
\r
477 \param speed: Speed in units per second, to attract to the specified
\r
479 \param attract: Whether the particles attract or detract from this
\r
481 \param affectX: Whether or not this will affect the X position of the
\r
483 \param affectY: Whether or not this will affect the Y position of the
\r
485 \param affectZ: Whether or not this will affect the Z position of the
\r
487 \return Pointer to the created particle affector. To add this affector
\r
488 as new affector of this particle system, just call addAffector(). Note
\r
489 that you'll have to drop() the returned pointer, after you don't need
\r
490 it any more, see IReferenceCounted::drop() for more information. */
\r
491 virtual IParticleAttractionAffector* createAttractionAffector(
\r
492 const core::vector3df& point, f32 speed = 1.0f, bool attract = true,
\r
493 bool affectX = true, bool affectY = true, bool affectZ = true) = 0;
\r
495 //! Creates a scale particle affector.
\r
496 /** This affector scales the particle to the a multiple of its size defined
\r
497 by the scaleTo variable.
\r
498 \param scaleTo: multiple of the size which the particle will be scaled to until deletion
\r
499 \return Pointer to the created particle affector.
\r
500 To add this affector as new affector of this particle system,
\r
501 just call addAffector(). Note that you'll have to drop() the
\r
502 returned pointer, after you don't need it any more, see
\r
503 IReferenceCounted::drop() for more information. */
\r
504 virtual IParticleAffector* createScaleParticleAffector(const core::dimension2df& scaleTo = core::dimension2df(1.0f, 1.0f)) = 0;
\r
506 //! Creates a fade out particle affector.
\r
507 /** This affector modifies the color of every particle and and reaches
\r
508 the final color when the particle dies. This affector looks really
\r
509 good, if the EMT_TRANSPARENT_ADD_COLOR material is used and the
\r
510 targetColor is video::SColor(0,0,0,0): Particles are fading out into
\r
511 void with this setting.
\r
512 \param targetColor: Color whereto the color of the particle is changed.
\r
513 \param timeNeededToFadeOut: How much time in milliseconds should the
\r
514 affector need to change the color to the targetColor.
\r
515 \return Pointer to the created particle affector. To add this affector
\r
516 as new affector of this particle system, just call addAffector(). Note
\r
517 that you'll have to drop() the returned pointer, after you don't need
\r
518 it any more, see IReferenceCounted::drop() for more information. */
\r
519 virtual IParticleFadeOutAffector* createFadeOutParticleAffector(
\r
520 const video::SColor& targetColor = video::SColor(0,0,0,0),
\r
521 u32 timeNeededToFadeOut = 1000) = 0;
\r
523 //! Creates a gravity affector.
\r
524 /** This affector modifies the direction of the particle. It assumes
\r
525 that the particle is fired out of the emitter with huge force, but is
\r
526 loosing this after some time and is caught by the gravity then. This
\r
527 affector is ideal for creating things like fountains.
\r
528 \param gravity: Direction and force of gravity.
\r
529 \param timeForceLost: Time in milliseconds when the force of the
\r
530 emitter is totally lost and the particle does not move any more. This
\r
531 is the time where gravity fully affects the particle.
\r
532 \return Pointer to the created particle affector. To add this affector
\r
533 as new affector of this particle system, just call addAffector(). Note
\r
534 that you'll have to drop() the returned pointer, after you don't need
\r
535 it any more, see IReferenceCounted::drop() for more information. */
\r
536 virtual IParticleGravityAffector* createGravityAffector(
\r
537 const core::vector3df& gravity = core::vector3df(0.0f,-0.03f,0.0f),
\r
538 u32 timeForceLost = 1000) = 0;
\r
540 //! Creates a rotation affector.
\r
541 /** This affector modifies the positions of the particles and attracts
\r
542 them to a specified point at a specified speed per second.
\r
543 \param speed: Rotation in degrees per second
\r
544 \param pivotPoint: Point to rotate the particles around
\r
545 \return Pointer to the created particle affector. To add this affector
\r
546 as new affector of this particle system, just call addAffector(). Note
\r
547 that you'll have to drop() the returned pointer, after you don't need
\r
548 it any more, see IReferenceCounted::drop() for more information. */
\r
549 virtual IParticleRotationAffector* createRotationAffector(
\r
550 const core::vector3df& speed = core::vector3df(5.0f,5.0f,5.0f),
\r
551 const core::vector3df& pivotPoint = core::vector3df(0.0f,0.0f,0.0f) ) = 0;
\r
553 //! Writes attributes of the scene node.
\r
554 virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_
\r
556 out->addInt("ParticleBehavior", ParticleBehavior);
\r
559 //! Reads attributes of the scene node.
\r
560 virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_
\r
562 ParticleBehavior = in->getAttributeAsInt("ParticleBehavior", ParticleBehavior);
\r
566 s32 ParticleBehavior;
\r
569 } // end namespace scene
\r
570 } // end namespace irr
\r