Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

osgParticle::Particle Class Reference

Implementation of a particle. More...

List of all members.

Public Types

enum  Shape { POINT, QUAD, QUAD_TRIANGLESTRIP, HEXAGON }

Public Methods

 Particle ()
Shape getShape () const
 Get the shape of the particle.

void setShape (Shape s)
 Set the shape of the particle.

bool isAlive () const
 Get whether the particle is still alive.

double getLifeTime () const
 Get the life time of the particle (in seconds).

double getAge () const
 Get the age of the particle (in seconds).

const rangefgetSizeRange () const
 Get the minimum and maximum values for polygon size.

const rangefgetAlphaRange () const
 Get the minimum and maximum values for alpha.

const rangev4getColorRange () const
 Get the minimum and maximum values for color.

const InterpolatorgetSizeInterpolator () const
 Get the interpolator for computing the size of polygons.

const InterpolatorgetAlphaInterpolator () const
 Get the interpolator for computing alpha values.

const InterpolatorgetColorInterpolator () const
 Get the interpolator for computing color values.

float getRadius () const
 Get the physical radius of the particle.

float getMass () const
 Get the mass of the particle.

float getMassInv () const
 Get 1 / getMass().

const osg::Vec3getPosition () const
 Get the position vector.

const osg::Vec3getVelocity () const
 Get the velocity vector.

const osg::Vec3getPreviousPosition () const
 Get the previous position (the position before last update).

void kill ()
 Kill the particle on next update NOTE: after calling this function, the isAlive() method will still return true until the particle is updated again.

void setLifeTime (double t)
 Set the life time of the particle.

void setSizeRange (const rangef &r)
 Set the minimum and maximum values for polygon size.

void setAlphaRange (const rangef &r)
 Set the minimum and maximum values for alpha.

void setColorRange (const rangev4 &r)
 Set the minimum and maximum values for color.

void setSizeInterpolator (Interpolator *ri)
 Set the interpolator for computing size values.

void setAlphaInterpolator (Interpolator *ai)
 Set the interpolator for computing alpha values.

void setColorInterpolator (Interpolator *ci)
 Set the interpolator for computing color values.

void setRadius (float r)
 Set the physical radius of the particle.

void setMass (float m)
 Set the mass of the particle.

void setPosition (const osg::Vec3 &p)
 Set the position vector.

void setVelocity (const osg::Vec3 &v)
 Set the velocity vector.

void addVelocity (const osg::Vec3 &dv)
 Add a vector to the velocity vector.

void transformPositionVelocity (const osg::Matrix &xform)
 Transform position and velocity vectors by a matrix.

bool update (double dt)
 Update the particle (don't call this method manually).

void beginRender ()
 Perform some pre-rendering tasks. Called automatically by particle systems.

void render (const osg::Vec3 &xpos, const osg::Vec3 &px, const osg::Vec3 &py, float scale=1.0f) const
 Render the particle. Called automatically by particle systems.

void endRender ()
 Perform some post-rendering tasks. Called automatically by particle systems.

float getCurrentSize () const
 Get the current (interpolated) polygon size. Valid only after the first call to update().


Detailed Description

Implementation of a particle.

Objects of this class are particles, they have some graphical properties and some physical properties. Particles are created by emitters and then placed into Particle Systems, where they live and get updated at each frame. Particles can either live forever (lifeTime < 0), or die after a specified time (lifeTime >= 0). For each property which is defined as a range of values, a "current" value will be evaluated at each frame by interpolating the min and max values so that curr_value = min when t == 0, and curr_value = max when t == lifeTime. You may customize the interpolator objects to achieve any kind of transition. If you want the particle to live forever, set its lifetime to any value <= 0; in that case, no interpolation is done to compute real-time properties, and only minimum values are used.


Member Enumeration Documentation

enum osgParticle::Particle::Shape
 

Enumeration values:
POINT 
QUAD 
QUAD_TRIANGLESTRIP 
HEXAGON 


Constructor & Destructor Documentation

osgParticle::Particle::Particle  
 


Member Function Documentation

void osgParticle::Particle::addVelocity const osg::Vec3   dv [inline]
 

Add a vector to the velocity vector.

void osgParticle::Particle::beginRender   [inline]
 

Perform some pre-rendering tasks. Called automatically by particle systems.

void osgParticle::Particle::endRender   [inline]
 

Perform some post-rendering tasks. Called automatically by particle systems.

double osgParticle::Particle::getAge   const [inline]
 

Get the age of the particle (in seconds).

const Interpolator * osgParticle::Particle::getAlphaInterpolator   const [inline]
 

Get the interpolator for computing alpha values.

const rangef & osgParticle::Particle::getAlphaRange   const [inline]
 

Get the minimum and maximum values for alpha.

const Interpolator * osgParticle::Particle::getColorInterpolator   const [inline]
 

Get the interpolator for computing color values.

const rangev4 & osgParticle::Particle::getColorRange   const [inline]
 

Get the minimum and maximum values for color.

float osgParticle::Particle::getCurrentSize   const [inline]
 

Get the current (interpolated) polygon size. Valid only after the first call to update().

double osgParticle::Particle::getLifeTime   const [inline]
 

Get the life time of the particle (in seconds).

float osgParticle::Particle::getMass   const [inline]
 

Get the mass of the particle.

For built-in operators to work correctly, remember that the mass is expressed in kg.

float osgParticle::Particle::getMassInv   const [inline]
 

Get 1 / getMass().

const osg::Vec3 & osgParticle::Particle::getPosition   const [inline]
 

Get the position vector.

const osg::Vec3 & osgParticle::Particle::getPreviousPosition   const [inline]
 

Get the previous position (the position before last update).

float osgParticle::Particle::getRadius   const [inline]
 

Get the physical radius of the particle.

For built-in operators to work correctly, lengths must be expressed in meters.

Particle::Shape osgParticle::Particle::getShape   const [inline]
 

Get the shape of the particle.

const Interpolator * osgParticle::Particle::getSizeInterpolator   const [inline]
 

Get the interpolator for computing the size of polygons.

const rangef & osgParticle::Particle::getSizeRange   const [inline]
 

Get the minimum and maximum values for polygon size.

const osg::Vec3 & osgParticle::Particle::getVelocity   const [inline]
 

Get the velocity vector.

For built-in operators to work correctly, remember that velocity components are expressed in meters per second.

bool osgParticle::Particle::isAlive   const [inline]
 

Get whether the particle is still alive.

void osgParticle::Particle::kill   [inline]
 

Kill the particle on next update NOTE: after calling this function, the isAlive() method will still return true until the particle is updated again.

void osgParticle::Particle::render const osg::Vec3   xpos,
const osg::Vec3   px,
const osg::Vec3   py,
float    scale = 1.0f
const
 

Render the particle. Called automatically by particle systems.

void osgParticle::Particle::setAlphaInterpolator Interpolator   ai [inline]
 

Set the interpolator for computing alpha values.

void osgParticle::Particle::setAlphaRange const rangef   r [inline]
 

Set the minimum and maximum values for alpha.

void osgParticle::Particle::setColorInterpolator Interpolator   ci [inline]
 

Set the interpolator for computing color values.

void osgParticle::Particle::setColorRange const rangev4   r [inline]
 

Set the minimum and maximum values for color.

void osgParticle::Particle::setLifeTime double    t [inline]
 

Set the life time of the particle.

void osgParticle::Particle::setMass float    m [inline]
 

Set the mass of the particle.

For built-in operators to work correctly, remember that the mass is expressed in kg.

void osgParticle::Particle::setPosition const osg::Vec3   p [inline]
 

Set the position vector.

void osgParticle::Particle::setRadius float    r [inline]
 

Set the physical radius of the particle.

For built-in operators to work correctly, lengths must be expressed in meters.

void osgParticle::Particle::setShape Shape    s [inline]
 

Set the shape of the particle.

void osgParticle::Particle::setSizeInterpolator Interpolator   ri [inline]
 

Set the interpolator for computing size values.

void osgParticle::Particle::setSizeRange const rangef   r [inline]
 

Set the minimum and maximum values for polygon size.

void osgParticle::Particle::setVelocity const osg::Vec3   v [inline]
 

Set the velocity vector.

For built-in operators to work correctly, remember that velocity components are expressed in meters per second.

void osgParticle::Particle::transformPositionVelocity const osg::Matrix   xform [inline]
 

Transform position and velocity vectors by a matrix.

bool osgParticle::Particle::update double    dt
 

Update the particle (don't call this method manually).

This method is called automatically by ParticleSystem::update(); it updates the graphical properties of the particle for the current time, checks whether the particle is still alive, and then updates its position by computing P = P + V * dt (where P is the position and V is the velocity).


The documentation for this class was generated from the following file:
Generated at Wed Sep 18 13:55:52 2002 for the Open Scene Graph by doxygen 1.2.16.