lbm_reference
Public Member Functions | Protected Attributes | Friends | List of all members
particles::Particle Class Reference

Individual particle of the particle system. More...

#include <particles/Particle.h>

+ Collaboration diagram for particles::Particle:

Public Member Functions

void clear ()
 Delete all sprites, i.e. remove them from the scene. More...
 
float dist (Particle &p)
 Get distance between this and another particle. More...
 
const core::vector3df & getPos ()
 Get current particle position. More...
 
 Particle ()
 Default constructor. More...
 
 Particle (scene::ISceneManager *mgr, s32 id, const core::vector3df &position, std::vector< video::ITexture * > &textures, int numSprites, float temp, video::SColor &color, float size, int lifetime, bool dynamicLights=false)
 Constructor for particles with sprites. More...
 
 Particle (const core::vector3df &position, float temp, int lifetime)
 Constructor for particles without sprites. More...
 
void setColor (const video::SColor &c)
 Set the color for all assigned sprites. More...
 
void setSize (float sz)
 Set the size for all assigned sprites. More...
 
void setSmoke (float colorCoeff)
 
void setTexture (std::vector< video::ITexture * > &textures)
 
void updatePos (const core::vector3df &d)
 Update particle position, including assigned sprites. More...
 
virtual ~Particle ()
 Destructor. More...
 

Protected Attributes

int lifetime_
 Current particle lifetime, decreased every timestep. More...
 
core::vector3df pos_
 Current particle position. More...
 
std::vector
< scene::IBillboardSceneNode * > 
sprites_
 Vector of sprites (display primitives) assigned to this particle. More...
 
float temp_
 Current particle temperature. More...
 
ParticleType type_
 Particle type (either FIRE or SMOKE) More...
 

Friends

class ParticleSystem
 Fried declaration to allow ParticleSystem class access to protected members. More...
 

Detailed Description

Individual particle of the particle system.

Has a configurable number of sprites (display primitives) assigned to it.

Definition at line 29 of file Particle.h.

Constructor & Destructor Documentation

particles::Particle::Particle ( )
inline

Default constructor.

Does nothing.

Definition at line 46 of file Particle.h.

particles::Particle::Particle ( scene::ISceneManager *  mgr,
s32  id,
const core::vector3df &  position,
std::vector< video::ITexture * > &  textures,
int  numSprites,
float  temp,
video::SColor &  color,
float  size,
int  lifetime,
bool  dynamicLights = false 
)

Constructor for particles with sprites.

Parameters
[in]mgrPointer to irrlicht scene manager
[in]idParticle ID
[in]positionInitial particle position
[in]textureTexture to assign to sprites of this particle
[in]numSpritesNumber of sprites assigned to each particle instance
[in]tempInitial particle temperature
[in]colorInitial particle color
[in]lifetimeParticle lifetime (in timesteps)
[in]dynamicLightsTurn dynamic lighting on / off

Definition at line 9 of file Particle.cpp.

References sprites_.

particles::Particle::Particle ( const core::vector3df &  position,
float  temp,
int  lifetime 
)
inline

Constructor for particles without sprites.

Parameters
[in]positionInitial particle position
[in]tempInitial particle temperature
[in]lifetimeParticle lifetime (in timesteps)

Definition at line 77 of file Particle.h.

virtual particles::Particle::~Particle ( )
inlinevirtual

Destructor.

Does nothing.

Definition at line 88 of file Particle.h.

Member Function Documentation

void particles::Particle::clear ( )
inline

Delete all sprites, i.e. remove them from the scene.

Definition at line 174 of file Particle.h.

float particles::Particle::dist ( Particle p)
inline

Get distance between this and another particle.

Parameters
[in]pParticle to measure distance from
Returns
Distance between this and given particle

Definition at line 99 of file Particle.h.

References pos_.

const core::vector3df& particles::Particle::getPos ( )
inline

Get current particle position.

Returns
Current particle position as vector

Definition at line 110 of file Particle.h.

void particles::Particle::setColor ( const video::SColor &  c)
inline

Set the color for all assigned sprites.

Parameters
[in]cColor to assign to all assigned sprites

Definition at line 135 of file Particle.h.

void particles::Particle::setSize ( float  sz)
inline

Set the size for all assigned sprites.

Parameters
[in]szSize to assign to all assigned sprites

Definition at line 146 of file Particle.h.

void particles::Particle::setSmoke ( float  colorCoeff)
inline

Definition at line 158 of file Particle.h.

References particles::SMOKE.

void particles::Particle::setTexture ( std::vector< video::ITexture * > &  textures)
inline

Definition at line 152 of file Particle.h.

void particles::Particle::updatePos ( const core::vector3df &  d)
inline

Update particle position, including assigned sprites.

Parameters
[in]dDisplacement vector by which particle is to be moved

Definition at line 122 of file Particle.h.

References RAND1.

Friends And Related Function Documentation

friend class ParticleSystem
friend

Fried declaration to allow ParticleSystem class access to protected members.

Definition at line 34 of file Particle.h.

Member Data Documentation

int particles::Particle::lifetime_
protected

Current particle lifetime, decreased every timestep.

Definition at line 200 of file Particle.h.

core::vector3df particles::Particle::pos_
protected

Current particle position.

Definition at line 191 of file Particle.h.

Referenced by dist().

std::vector< scene::IBillboardSceneNode* > particles::Particle::sprites_
protected

Vector of sprites (display primitives) assigned to this particle.

Definition at line 188 of file Particle.h.

Referenced by Particle().

float particles::Particle::temp_
protected

Current particle temperature.

Definition at line 197 of file Particle.h.

ParticleType particles::Particle::type_
protected

Particle type (either FIRE or SMOKE)

Definition at line 194 of file Particle.h.


The documentation for this class was generated from the following files: