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