123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573 |
- // Copyright (C) 2002-2012 Nikolaus Gebhardt
- // This file is part of the "Irrlicht Engine".
- // For conditions of distribution and use, see copyright notice in irrlicht.h
- #ifndef IRR_I_PARTICLE_SYSTEM_SCENE_NODE_H_INCLUDED
- #define IRR_I_PARTICLE_SYSTEM_SCENE_NODE_H_INCLUDED
- #include "ISceneNode.h"
- #include "IParticleAnimatedMeshSceneNodeEmitter.h"
- #include "IParticleBoxEmitter.h"
- #include "IParticleCylinderEmitter.h"
- #include "IParticleMeshEmitter.h"
- #include "IParticleRingEmitter.h"
- #include "IParticleSphereEmitter.h"
- #include "IParticleAttractionAffector.h"
- #include "IParticleFadeOutAffector.h"
- #include "IParticleGravityAffector.h"
- #include "IParticleRotationAffector.h"
- #include "dimension2d.h"
- namespace irr
- {
- namespace scene
- {
- //! A particle system scene node for creating snow, fire, explosions, smoke...
- /** A scene node controlling a particle System. The behavior of the particles
- can be controlled by setting the right particle emitters and affectors.
- You can for example easily create a campfire by doing this:
- \code
- scene::IParticleSystemSceneNode* p = scenemgr->addParticleSystemSceneNode();
- p->setParticleSize(core::dimension2d<f32>(20.0f, 10.0f));
- scene::IParticleEmitter* em = p->createBoxEmitter(
- core::aabbox3d<f32>(-5,0,-5,5,1,5),
- core::vector3df(0.0f,0.03f,0.0f),
- 40,80, video::SColor(0,255,255,255),video::SColor(0,255,255,255), 1100,2000);
- p->setEmitter(em);
- em->drop();
- scene::IParticleAffector* paf = p->createFadeOutParticleAffector();
- p->addAffector(paf);
- paf->drop();
- \endcode
- */
- //! Bitflags to control particle behavior
- enum EParticleBehavior
- {
- //! Continue emitting new particles even when the node is invisible
- EPB_INVISIBLE_EMITTING = 1,
- //! Continue affecting particles even when the node is invisible
- EPB_INVISIBLE_AFFECTING = 2,
- //! Continue updating particle positions or deleting them even when the node is invisible
- EPB_INVISIBLE_ANIMATING = 4,
- //! Clear all particles when node gets invisible
- EPB_CLEAR_ON_INVISIBLE = 8,
- //! Particle movement direction on emitting ignores the node rotation
- //! This is mainly to allow backward compatible behavior to Irrlicht 1.8
- EPB_EMITTER_VECTOR_IGNORE_ROTATION = 16,
- //! On emitting global particles interpolate the positions randomly between the last and current node transformations.
- //! This can be set to avoid gaps caused by fast node movement or low framerates, but will be somewhat
- //! slower to calculate.
- EPB_EMITTER_FRAME_INTERPOLATION = 32
- };
- class IParticleSystemSceneNode : public ISceneNode
- {
- public:
- //! Constructor
- IParticleSystemSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
- const core::vector3df& position = core::vector3df(0,0,0),
- const core::vector3df& rotation = core::vector3df(0,0,0),
- const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f))
- : ISceneNode(parent, mgr, id, position, rotation, scale)
- , ParticleBehavior(0)
- {
- }
- //! Sets the size of all particles.
- virtual void setParticleSize(
- const core::dimension2d<f32> &size = core::dimension2d<f32>(5.0f, 5.0f)) = 0;
- //! Sets if the particles should be global.
- /** If they are, the particles are affected by the movement of the
- particle system scene node too, otherwise they completely ignore it.
- Default is true. */
- virtual void setParticlesAreGlobal(bool global=true) = 0;
- //! Bitflags to change the particle behavior
- /**
- \param flags A combination of ::EParticleBehavior bit-flags. Default is 0. */
- virtual void setParticleBehavior(irr::u32 flags)
- {
- ParticleBehavior = flags;
- }
- //! Gets how particles behave in different situations
- /**
- \return A combination of ::EParticleBehavior flags */
- virtual irr::u32 getParticleBehavior() const
- {
- return ParticleBehavior;
- }
- //! Remove all currently visible particles
- virtual void clearParticles() = 0;
- //! Do manually update the particles.
- /** This should only be called when you want to render the node outside
- the scenegraph, as the node will care about this otherwise
- automatically. */
- virtual void doParticleSystem(u32 time) = 0;
- //! Gets the particle emitter, which creates the particles.
- /** \return The particle emitter. Can be 0 if none is set. */
- virtual IParticleEmitter* getEmitter() =0;
- //! Sets the particle emitter, which creates the particles.
- /** A particle emitter can be created using one of the createEmitter
- methods. For example to create and use a simple PointEmitter, call
- IParticleEmitter* p = createPointEmitter(); setEmitter(p); p->drop();
- \param emitter: Sets the particle emitter. You can set this to 0 for
- removing the current emitter and stopping the particle system emitting
- new particles. */
- virtual void setEmitter(IParticleEmitter* emitter) = 0;
- //! Adds new particle effector to the particle system.
- /** A particle affector modifies the particles. For example, the FadeOut
- affector lets all particles fade out after some time. It is created and
- used in this way:
- \code
- IParticleAffector* p = createFadeOutParticleAffector();
- addAffector(p);
- p->drop();
- \endcode
- Please note that an affector is not necessary for the particle system to
- work.
- \param affector: New affector. */
- virtual void addAffector(IParticleAffector* affector) = 0;
- //! Get a list of all particle affectors.
- /** \return The list of particle affectors attached to this node. */
- virtual const core::list<IParticleAffector*>& getAffectors() const = 0;
- //! Removes all particle affectors in the particle system.
- virtual void removeAllAffectors() = 0;
- //! Creates a particle emitter for an animated mesh scene node
- /** \param node: Pointer to the animated mesh scene node to emit
- particles from
- \param useNormalDirection: If true, the direction of each particle
- created will be the normal of the vertex that it's emitting from. The
- normal is divided by the normalDirectionModifier parameter, which
- defaults to 100.0f.
- \param direction: Direction and speed of particle emission.
- \param normalDirectionModifier: If the emitter is using the normal
- direction then the normal of the vertex that is being emitted from is
- divided by this number.
- \param mbNumber: This allows you to specify a specific meshBuffer for
- the IMesh* to emit particles from. The default value is -1, which
- means a random meshBuffer picked from all of the meshes meshBuffers
- will be selected to pick a random vertex from. If the value is 0 or
- greater, it will only pick random vertices from the meshBuffer
- specified by this value.
- \param everyMeshVertex: If true, the emitter will emit between min/max
- particles every second, for every vertex in the mesh, if false, it will
- emit between min/max particles from random vertices in the mesh.
- \param minParticlesPerSecond: Minimal amount of particles emitted per
- second.
- \param maxParticlesPerSecond: Maximal amount of particles emitted per
- second.
- \param minStartColor: Minimal initial start color of a particle. The
- real color of every particle is calculated as random interpolation
- between minStartColor and maxStartColor.
- \param maxStartColor: Maximal initial start color of a particle. The
- real color of every particle is calculated as random interpolation
- between minStartColor and maxStartColor.
- \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
- \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
- \param maxAngleDegrees: Maximal angle in degrees, the emitting
- direction of the particle will differ from the original direction.
- \param minStartSize: Minimal initial start size of a particle. The
- real size of every particle is calculated as random interpolation
- between minStartSize and maxStartSize.
- \param maxStartSize: Maximal initial start size of a particle. The
- real size of every particle is calculated as random interpolation
- between minStartSize and maxStartSize.
- \return Pointer to the created particle emitter. To set this emitter
- as new emitter of this particle system, just call setEmitter(). Note
- that you'll have to drop() the returned pointer, after you don't need
- it any more, see IReferenceCounted::drop() for more information. */
- virtual IParticleAnimatedMeshSceneNodeEmitter* createAnimatedMeshSceneNodeEmitter(
- scene::IAnimatedMeshSceneNode* node, bool useNormalDirection = true,
- const core::vector3df& direction = core::vector3df(0.0f,0.03f,0.0f),
- f32 normalDirectionModifier = 100.0f, s32 mbNumber = -1,
- bool everyMeshVertex = false,
- u32 minParticlesPerSecond = 5, u32 maxParticlesPerSecond = 10,
- const video::SColor& minStartColor = video::SColor(255,0,0,0),
- const video::SColor& maxStartColor = video::SColor(255,255,255,255),
- u32 lifeTimeMin = 2000, u32 lifeTimeMax = 4000,
- s32 maxAngleDegrees = 0,
- const core::dimension2df& minStartSize = core::dimension2df(5.0f,5.0f),
- const core::dimension2df& maxStartSize = core::dimension2df(5.0f,5.0f) ) = 0;
- //! Creates a box particle emitter.
- /** \param box: The box for the emitter.
- \param direction: Direction and speed of particle emission.
- \param minParticlesPerSecond: Minimal amount of particles emitted per
- second.
- \param maxParticlesPerSecond: Maximal amount of particles emitted per
- second.
- \param minStartColor: Minimal initial start color of a particle. The
- real color of every particle is calculated as random interpolation
- between minStartColor and maxStartColor.
- \param maxStartColor: Maximal initial start color of a particle. The
- real color of every particle is calculated as random interpolation
- between minStartColor and maxStartColor.
- \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
- \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
- \param maxAngleDegrees: Maximal angle in degrees, the emitting
- direction of the particle will differ from the original direction.
- \param minStartSize: Minimal initial start size of a particle. The
- real size of every particle is calculated as random interpolation
- between minStartSize and maxStartSize.
- \param maxStartSize: Maximal initial start size of a particle. The
- real size of every particle is calculated as random interpolation
- between minStartSize and maxStartSize.
- \return Pointer to the created particle emitter. To set this emitter
- as new emitter of this particle system, just call setEmitter(). Note
- that you'll have to drop() the returned pointer, after you don't need
- it any more, see IReferenceCounted::drop() for more information. */
- virtual IParticleBoxEmitter* createBoxEmitter(
- const core::aabbox3df& box = core::aabbox3df(-10,28,-10,10,30,10),
- const core::vector3df& direction = core::vector3df(0.0f,0.03f,0.0f),
- u32 minParticlesPerSecond = 5,
- u32 maxParticlesPerSecond = 10,
- const video::SColor& minStartColor = video::SColor(255,0,0,0),
- const video::SColor& maxStartColor = video::SColor(255,255,255,255),
- u32 lifeTimeMin=2000, u32 lifeTimeMax=4000,
- s32 maxAngleDegrees=0,
- const core::dimension2df& minStartSize = core::dimension2df(5.0f,5.0f),
- const core::dimension2df& maxStartSize = core::dimension2df(5.0f,5.0f) ) = 0;
- //! Creates a particle emitter for emitting from a cylinder
- /** \param center: The center of the circle at the base of the cylinder
- \param radius: The thickness of the cylinder
- \param normal: Direction of the length of the cylinder
- \param length: The length of the the cylinder
- \param outlineOnly: Whether or not to put points inside the cylinder or
- on the outline only
- \param direction: Direction and speed of particle emission.
- \param minParticlesPerSecond: Minimal amount of particles emitted per
- second.
- \param maxParticlesPerSecond: Maximal amount of particles emitted per
- second.
- \param minStartColor: Minimal initial start color of a particle. The
- real color of every particle is calculated as random interpolation
- between minStartColor and maxStartColor.
- \param maxStartColor: Maximal initial start color of a particle. The
- real color of every particle is calculated as random interpolation
- between minStartColor and maxStartColor.
- \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
- \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
- \param maxAngleDegrees: Maximal angle in degrees, the emitting
- direction of the particle will differ from the original direction.
- \param minStartSize: Minimal initial start size of a particle. The
- real size of every particle is calculated as random interpolation
- between minStartSize and maxStartSize.
- \param maxStartSize: Maximal initial start size of a particle. The
- real size of every particle is calculated as random interpolation
- between minStartSize and maxStartSize.
- \return Pointer to the created particle emitter. To set this emitter
- as new emitter of this particle system, just call setEmitter(). Note
- that you'll have to drop() the returned pointer, after you don't need
- it any more, see IReferenceCounted::drop() for more information. */
- virtual IParticleCylinderEmitter* createCylinderEmitter(
- const core::vector3df& center, f32 radius,
- const core::vector3df& normal, f32 length,
- bool outlineOnly = false,
- const core::vector3df& direction = core::vector3df(0.0f,0.03f,0.0f),
- u32 minParticlesPerSecond = 5, u32 maxParticlesPerSecond = 10,
- const video::SColor& minStartColor = video::SColor(255,0,0,0),
- const video::SColor& maxStartColor = video::SColor(255,255,255,255),
- u32 lifeTimeMin = 2000, u32 lifeTimeMax = 4000,
- s32 maxAngleDegrees = 0,
- const core::dimension2df& minStartSize = core::dimension2df(5.0f,5.0f),
- const core::dimension2df& maxStartSize = core::dimension2df(5.0f,5.0f) ) = 0;
- //! Creates a mesh particle emitter.
- /** \param mesh: Pointer to mesh to emit particles from
- \param useNormalDirection: If true, the direction of each particle
- created will be the normal of the vertex that it's emitting from. The
- normal is divided by the normalDirectionModifier parameter, which
- defaults to 100.0f.
- \param direction: Direction and speed of particle emission.
- \param normalDirectionModifier: If the emitter is using the normal
- direction then the normal of the vertex that is being emitted from is
- divided by this number.
- \param mbNumber: This allows you to specify a specific meshBuffer for
- the IMesh* to emit particles from. The default value is -1, which
- means a random meshBuffer picked from all of the meshes meshBuffers
- will be selected to pick a random vertex from. If the value is 0 or
- greater, it will only pick random vertices from the meshBuffer
- specified by this value.
- \param everyMeshVertex: If true, the emitter will emit between min/max
- particles every second, for every vertex in the mesh, if false, it will
- emit between min/max particles from random vertices in the mesh.
- \param minParticlesPerSecond: Minimal amount of particles emitted per
- second.
- \param maxParticlesPerSecond: Maximal amount of particles emitted per
- second.
- \param minStartColor: Minimal initial start color of a particle. The
- real color of every particle is calculated as random interpolation
- between minStartColor and maxStartColor.
- \param maxStartColor: Maximal initial start color of a particle. The
- real color of every particle is calculated as random interpolation
- between minStartColor and maxStartColor.
- \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
- \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
- \param maxAngleDegrees: Maximal angle in degrees, the emitting
- direction of the particle will differ from the original direction.
- \param minStartSize: Minimal initial start size of a particle. The
- real size of every particle is calculated as random interpolation
- between minStartSize and maxStartSize.
- \param maxStartSize: Maximal initial start size of a particle. The
- real size of every particle is calculated as random interpolation
- between minStartSize and maxStartSize.
- \return Pointer to the created particle emitter. To set this emitter
- as new emitter of this particle system, just call setEmitter(). Note
- that you'll have to drop() the returned pointer, after you don't need
- it any more, see IReferenceCounted::drop() for more information. */
- virtual IParticleMeshEmitter* createMeshEmitter(
- scene::IMesh* mesh, bool useNormalDirection = true,
- const core::vector3df& direction = core::vector3df(0.0f,0.03f,0.0f),
- f32 normalDirectionModifier = 100.0f, s32 mbNumber = -1,
- bool everyMeshVertex = false,
- u32 minParticlesPerSecond = 5, u32 maxParticlesPerSecond = 10,
- const video::SColor& minStartColor = video::SColor(255,0,0,0),
- const video::SColor& maxStartColor = video::SColor(255,255,255,255),
- u32 lifeTimeMin = 2000, u32 lifeTimeMax = 4000,
- s32 maxAngleDegrees = 0,
- const core::dimension2df& minStartSize = core::dimension2df(5.0f,5.0f),
- const core::dimension2df& maxStartSize = core::dimension2df(5.0f,5.0f) ) = 0;
- //! Creates a point particle emitter.
- /** \param direction: Direction and speed of particle emission.
- \param minParticlesPerSecond: Minimal amount of particles emitted per
- second.
- \param maxParticlesPerSecond: Maximal amount of particles emitted per
- second.
- \param minStartColor: Minimal initial start color of a particle. The
- real color of every particle is calculated as random interpolation
- between minStartColor and maxStartColor.
- \param maxStartColor: Maximal initial start color of a particle. The
- real color of every particle is calculated as random interpolation
- between minStartColor and maxStartColor.
- \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
- \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
- \param maxAngleDegrees: Maximal angle in degrees, the emitting
- direction of the particle will differ from the original direction.
- \param minStartSize: Minimal initial start size of a particle. The
- real size of every particle is calculated as random interpolation
- between minStartSize and maxStartSize.
- \param maxStartSize: Maximal initial start size of a particle. The
- real size of every particle is calculated as random interpolation
- between minStartSize and maxStartSize.
- \return Pointer to the created particle emitter. To set this emitter
- as new emitter of this particle system, just call setEmitter(). Note
- that you'll have to drop() the returned pointer, after you don't need
- it any more, see IReferenceCounted::drop() for more information. */
- virtual IParticlePointEmitter* createPointEmitter(
- const core::vector3df& direction = core::vector3df(0.0f,0.03f,0.0f),
- u32 minParticlesPerSecond = 5,
- u32 maxParticlesPerSecond = 10,
- const video::SColor& minStartColor = video::SColor(255,0,0,0),
- const video::SColor& maxStartColor = video::SColor(255,255,255,255),
- u32 lifeTimeMin=2000, u32 lifeTimeMax=4000,
- s32 maxAngleDegrees=0,
- const core::dimension2df& minStartSize = core::dimension2df(5.0f,5.0f),
- const core::dimension2df& maxStartSize = core::dimension2df(5.0f,5.0f) ) = 0;
- //! Creates a ring particle emitter.
- /** \param center: Center of ring
- \param radius: Distance of points from center, points will be rotated
- around the Y axis at a random 360 degrees and will then be shifted by
- the provided ringThickness values in each axis.
- \param ringThickness : thickness of the ring or how wide the ring is
- \param direction: Direction and speed of particle emission.
- \param minParticlesPerSecond: Minimal amount of particles emitted per
- second.
- \param maxParticlesPerSecond: Maximal amount of particles emitted per
- second.
- \param minStartColor: Minimal initial start color of a particle. The
- real color of every particle is calculated as random interpolation
- between minStartColor and maxStartColor.
- \param maxStartColor: Maximal initial start color of a particle. The
- real color of every particle is calculated as random interpolation
- between minStartColor and maxStartColor.
- \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
- \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
- \param maxAngleDegrees: Maximal angle in degrees, the emitting
- direction of the particle will differ from the original direction.
- \param minStartSize: Minimal initial start size of a particle. The
- real size of every particle is calculated as random interpolation
- between minStartSize and maxStartSize.
- \param maxStartSize: Maximal initial start size of a particle. The
- real size of every particle is calculated as random interpolation
- between minStartSize and maxStartSize.
- \return Pointer to the created particle emitter. To set this emitter
- as new emitter of this particle system, just call setEmitter(). Note
- that you'll have to drop() the returned pointer, after you don't need
- it any more, see IReferenceCounted::drop() for more information. */
- virtual IParticleRingEmitter* createRingEmitter(
- const core::vector3df& center, f32 radius, f32 ringThickness,
- const core::vector3df& direction = core::vector3df(0.0f,0.03f,0.0f),
- u32 minParticlesPerSecond = 5,
- u32 maxParticlesPerSecond = 10,
- const video::SColor& minStartColor = video::SColor(255,0,0,0),
- const video::SColor& maxStartColor = video::SColor(255,255,255,255),
- u32 lifeTimeMin=2000, u32 lifeTimeMax=4000,
- s32 maxAngleDegrees=0,
- const core::dimension2df& minStartSize = core::dimension2df(5.0f,5.0f),
- const core::dimension2df& maxStartSize = core::dimension2df(5.0f,5.0f) ) = 0;
- //! Creates a sphere particle emitter.
- /** \param center: Center of sphere
- \param radius: Radius of sphere
- \param direction: Direction and speed of particle emission.
- \param minParticlesPerSecond: Minimal amount of particles emitted per
- second.
- \param maxParticlesPerSecond: Maximal amount of particles emitted per
- second.
- \param minStartColor: Minimal initial start color of a particle. The
- real color of every particle is calculated as random interpolation
- between minStartColor and maxStartColor.
- \param maxStartColor: Maximal initial start color of a particle. The
- real color of every particle is calculated as random interpolation
- between minStartColor and maxStartColor.
- \param lifeTimeMin: Minimal lifetime of a particle, in milliseconds.
- \param lifeTimeMax: Maximal lifetime of a particle, in milliseconds.
- \param maxAngleDegrees: Maximal angle in degrees, the emitting
- direction of the particle will differ from the original direction.
- \param minStartSize: Minimal initial start size of a particle. The
- real size of every particle is calculated as random interpolation
- between minStartSize and maxStartSize.
- \param maxStartSize: Maximal initial start size of a particle. The
- real size of every particle is calculated as random interpolation
- between minStartSize and maxStartSize.
- \return Pointer to the created particle emitter. To set this emitter
- as new emitter of this particle system, just call setEmitter(). Note
- that you'll have to drop() the returned pointer, after you don't need
- it any more, see IReferenceCounted::drop() for more information. */
- virtual IParticleSphereEmitter* createSphereEmitter(
- const core::vector3df& center, f32 radius,
- const core::vector3df& direction = core::vector3df(0.0f,0.03f,0.0f),
- u32 minParticlesPerSecond = 5,
- u32 maxParticlesPerSecond = 10,
- const video::SColor& minStartColor = video::SColor(255,0,0,0),
- const video::SColor& maxStartColor = video::SColor(255,255,255,255),
- u32 lifeTimeMin=2000, u32 lifeTimeMax=4000,
- s32 maxAngleDegrees=0,
- const core::dimension2df& minStartSize = core::dimension2df(5.0f,5.0f),
- const core::dimension2df& maxStartSize = core::dimension2df(5.0f,5.0f) ) = 0;
- //! Creates a point attraction affector.
- /** This affector modifies the positions of the particles and attracts
- them to a specified point at a specified speed per second.
- \param point: Point to attract particles to.
- \param speed: Speed in units per second, to attract to the specified
- point.
- \param attract: Whether the particles attract or detract from this
- point.
- \param affectX: Whether or not this will affect the X position of the
- particle.
- \param affectY: Whether or not this will affect the Y position of the
- particle.
- \param affectZ: Whether or not this will affect the Z position of the
- particle.
- \return Pointer to the created particle affector. To add this affector
- as new affector of this particle system, just call addAffector(). Note
- that you'll have to drop() the returned pointer, after you don't need
- it any more, see IReferenceCounted::drop() for more information. */
- virtual IParticleAttractionAffector* createAttractionAffector(
- const core::vector3df& point, f32 speed = 1.0f, bool attract = true,
- bool affectX = true, bool affectY = true, bool affectZ = true) = 0;
- //! Creates a scale particle affector.
- /** This affector scales the particle to the a multiple of its size defined
- by the scaleTo variable.
- \param scaleTo: multiple of the size which the particle will be scaled to until deletion
- \return Pointer to the created particle affector.
- To add this affector as new affector of this particle system,
- just call addAffector(). Note that you'll have to drop() the
- returned pointer, after you don't need it any more, see
- IReferenceCounted::drop() for more information. */
- virtual IParticleAffector* createScaleParticleAffector(const core::dimension2df& scaleTo = core::dimension2df(1.0f, 1.0f)) = 0;
- //! Creates a fade out particle affector.
- /** This affector modifies the color of every particle and and reaches
- the final color when the particle dies. This affector looks really
- good, if the EMT_TRANSPARENT_ADD_COLOR material is used and the
- targetColor is video::SColor(0,0,0,0): Particles are fading out into
- void with this setting.
- \param targetColor: Color whereto the color of the particle is changed.
- \param timeNeededToFadeOut: How much time in milliseconds should the
- affector need to change the color to the targetColor.
- \return Pointer to the created particle affector. To add this affector
- as new affector of this particle system, just call addAffector(). Note
- that you'll have to drop() the returned pointer, after you don't need
- it any more, see IReferenceCounted::drop() for more information. */
- virtual IParticleFadeOutAffector* createFadeOutParticleAffector(
- const video::SColor& targetColor = video::SColor(0,0,0,0),
- u32 timeNeededToFadeOut = 1000) = 0;
- //! Creates a gravity affector.
- /** This affector modifies the direction of the particle. It assumes
- that the particle is fired out of the emitter with huge force, but is
- loosing this after some time and is caught by the gravity then. This
- affector is ideal for creating things like fountains.
- \param gravity: Direction and force of gravity.
- \param timeForceLost: Time in milliseconds when the force of the
- emitter is totally lost and the particle does not move any more. This
- is the time where gravity fully affects the particle.
- \return Pointer to the created particle affector. To add this affector
- as new affector of this particle system, just call addAffector(). Note
- that you'll have to drop() the returned pointer, after you don't need
- it any more, see IReferenceCounted::drop() for more information. */
- virtual IParticleGravityAffector* createGravityAffector(
- const core::vector3df& gravity = core::vector3df(0.0f,-0.03f,0.0f),
- u32 timeForceLost = 1000) = 0;
- //! Creates a rotation affector.
- /** This affector modifies the positions of the particles and attracts
- them to a specified point at a specified speed per second.
- \param speed: Rotation in degrees per second
- \param pivotPoint: Point to rotate the particles around
- \return Pointer to the created particle affector. To add this affector
- as new affector of this particle system, just call addAffector(). Note
- that you'll have to drop() the returned pointer, after you don't need
- it any more, see IReferenceCounted::drop() for more information. */
- virtual IParticleRotationAffector* createRotationAffector(
- const core::vector3df& speed = core::vector3df(5.0f,5.0f,5.0f),
- const core::vector3df& pivotPoint = core::vector3df(0.0f,0.0f,0.0f) ) = 0;
- //! Writes attributes of the scene node.
- virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const IRR_OVERRIDE
- {
- out->addInt("ParticleBehavior", ParticleBehavior);
- }
- //! Reads attributes of the scene node.
- virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) IRR_OVERRIDE
- {
- ParticleBehavior = in->getAttributeAsInt("ParticleBehavior", ParticleBehavior);
- }
- protected:
- s32 ParticleBehavior;
- };
- } // end namespace scene
- } // end namespace irr
- #endif
|