class OSGPARTICLE_EXPORT osgParticle::Particle

Implementation of a particle.

Public Methods

[more] Particle()
[more]inline Shape getShape() const
Get the shape of the particle
[more]bool update(double dt)
Update the particle (don't call this method manually).
[more]void render(const osg::Vec3 &xpos, const osg::Vec3 &px, const osg::Vec3 &py, float scale = 1.0f) const
Render the particle.
[more]inline Particle::Shape getShape() const
[more]inline void setShape(Shape s)
Set the shape of the particle
[more]inline bool isAlive() const
Get whether the particle is still alive
[more]inline double getLifeTime() const
Get the life time of the particle (in seconds)
[more]inline double getAge() const
Get the age of the particle (in seconds)
[more]inline float getRadius() const
Get the physical radius of the particle.
[more]inline void setRadius(float r)
Set the physical radius of the particle.
[more]inline const rangef& getSizeRange() const
Get the minimum and maximum values for polygon size
[more]inline const rangef& getAlphaRange() const
Get the minimum and maximum values for alpha
[more]inline const rangev4& getColorRange() const
Get the minimum and maximum values for color
[more]inline const Interpolator* getSizeInterpolator() const
Get the interpolator for computing the size of polygons
[more]inline const Interpolator* getAlphaInterpolator() const
Get the interpolator for computing alpha values
[more]inline const Interpolator* getColorInterpolator() const
Get the interpolator for computing color values
[more]inline const osg::Vec3& getPosition() const
Get the position vector
[more]inline const osg::Vec3& getVelocity() const
Get the velocity vector.
[more]inline const osg::Vec3& getPreviousPosition() const
Get the previous position (the position before last update)
[more]inline 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
[more]inline void setLifeTime(double t)
Set the life time of the particle
[more]inline void setSizeRange(const rangef &r)
Set the minimum and maximum values for polygon size
[more]inline void setAlphaRange(const rangef &r)
Set the minimum and maximum values for alpha
[more]inline void setColorRange(const rangev4 &r)
Set the minimum and maximum values for color
[more]inline void setSizeInterpolator(Interpolator* ri)
Set the interpolator for computing size values
[more]inline void setAlphaInterpolator(Interpolator* ai)
Set the interpolator for computing alpha values.
[more]inline void setColorInterpolator(Interpolator* ci)
Set the interpolator for computing color values
[more]inline void setPosition(const osg::Vec3 &p)
Set the position vector.
[more]inline void setVelocity(const osg::Vec3 &v)
Set the velocity vector.
[more]inline void addVelocity(const osg::Vec3 &v)
Add a vector to the velocity vector
[more]inline void transformPositionVelocity(const osg::Matrix &xform)
Transform position and velocity vectors by a matrix
[more]inline float getMass() const
Get the mass of the particle.
[more]inline float getMassInv() const
Get 1 / getMass()
[more]inline void setMass(float m)
Set the mass of the particle.
[more]inline void beginRender()
Perform some pre-rendering tasks.
[more]inline void endRender()
Perform some post-rendering tasks.
[more]inline float getCurrentSize() const
Get the current (interpolated) polygon size.

Public Members

[more]enum Shape


Documentation

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.
oenum Shape

o POINT

o QUAD

o QUAD_TRIANGLESTRIP

o HEXAGON

o Particle()

oinline Shape getShape() const
Get the shape of the particle

obool 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).

ovoid 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.

oinline Particle::Shape getShape() const

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

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

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

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

oinline float getRadius() const
Get the physical radius of the particle. For built-in operators to work correctly, lengths must be expressed in meters.

oinline void setRadius(float r)
Set the physical radius of the particle. For built-in operators to work correctly, lengths must be expressed in meters.

oinline const rangef& getSizeRange() const
Get the minimum and maximum values for polygon size

oinline const rangef& getAlphaRange() const
Get the minimum and maximum values for alpha

oinline const rangev4& getColorRange() const
Get the minimum and maximum values for color

oinline const Interpolator* getSizeInterpolator() const
Get the interpolator for computing the size of polygons

oinline const Interpolator* getAlphaInterpolator() const
Get the interpolator for computing alpha values

oinline const Interpolator* getColorInterpolator() const
Get the interpolator for computing color values

oinline const osg::Vec3& getPosition() const
Get the position vector

oinline const osg::Vec3& getVelocity() const
Get the velocity vector. For built-in operators to work correctly, remember that velocity components are expressed in meters per second.

oinline const osg::Vec3& getPreviousPosition() const
Get the previous position (the position before last update)

oinline 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

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

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

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

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

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

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

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

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

oinline void setVelocity(const osg::Vec3 &v)
Set the velocity vector. For built-in operators to work correctly, remember that velocity components are expressed in meters per second.

oinline void addVelocity(const osg::Vec3 &v)
Add a vector to the velocity vector

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

oinline float getMass() const
Get the mass of the particle. For built-in operators to work correctly, remember that the mass is expressed in kg.

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

oinline void setMass(float m)
Set the mass of the particle. For built-in operators to work correctly, remember that the mass is expressed in kg.

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

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

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


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.