Public Types | |
enum | { INVALID_INDEX = -1 } |
enum | Shape { POINT, QUAD, QUAD_TRIANGLESTRIP, HEXAGON, LINE } |
Public Member Functions | |
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 rangef & | getSizeRange () const |
Get the minimum and maximum values for polygon size. | |
const rangef & | getAlphaRange () const |
Get the minimum and maximum values for alpha. | |
const rangev4 & | getColorRange () const |
Get the minimum and maximum values for color. | |
const Interpolator * | getSizeInterpolator () const |
Get the interpolator for computing the size of polygons. | |
const Interpolator * | getAlphaInterpolator () const |
Get the interpolator for computing alpha values. | |
const Interpolator * | getColorInterpolator () const |
Get the interpolator for computing color values. | |
float | getRadius () const |
float | getMass () const |
float | getMassInv () const |
Get 1 / getMass() . | |
const osg::Vec3 & | getPosition () const |
Get the position vector. | |
const osg::Vec3 & | getVelocity () const |
const osg::Vec3 & | getPreviousPosition () const |
Get the previous position (the position before last update). | |
const osg::Vec3 & | getAngle () const |
Get the angle vector. | |
const osg::Vec3 & | getAngularVelocity () const |
Get the rotational velocity vector. | |
const osg::Vec3 & | getPreviousAngle () const |
Get the previous angle vector. | |
const osg::Vec4 & | getCurrentColor () const |
Get the current color. | |
float | getCurrentAlpha () const |
Get the current alpha. | |
float | getSTexCoord () const |
Get the s texture coordinate of the bottom left of the particle. | |
float | getTTexCoord () const |
Get the t texture coordinate of the bottom left of the particle. | |
int | getTileS () const |
Get width of texture tile. | |
int | getTileT () const |
Get height of texture tile. | |
int | getNumTiles () const |
Get number of texture tiles. | |
void | kill () |
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) |
void | setMass (float m) |
void | setPosition (const osg::Vec3 &p) |
Set the position vector. | |
void | setVelocity (const osg::Vec3 &v) |
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. | |
void | transformPositionVelocity (const osg::Matrix &xform1, const osg::Matrix &xform2, float r) |
Transform position and velocity vectors by a combination of two matrices. | |
void | setAngle (const osg::Vec3 &a) |
Set the angle vector. | |
void | setAngularVelocity (const osg::Vec3 &v) |
void | addAngularVelocity (const osg::Vec3 &dv) |
Add a vector to the angular velocity vector. | |
void | transformAngleVelocity (const osg::Matrix &xform) |
Transform angle and angularVelocity vectors by a matrix. | |
bool | update (double dt) |
void | beginRender (osg::GLBeginEndAdapter *gl) const |
Perform some pre-rendering tasks. Called automatically by particle systems. | |
void | render (osg::GLBeginEndAdapter *gl, 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 (osg::GLBeginEndAdapter *gl) const |
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(). | |
void | setTextureTileRange (int sTile, int tTile, int startTile, int endTile) |
void | setTextureTile (int sTile, int tTile, int end=-1) |
Same as above, range starts at 0 and ends at end. | |
void | setPreviousParticle (int previous) |
Set the previous particle. | |
int | getPreviousParticle () const |
Get the previous particle. | |
void | setNextParticle (int next) |
Set the next particle. | |
int | getNextParticle () const |
Get the const next particle. | |
void | setUpTexCoordsAsPartOfConnectedParticleSystem (ParticleSystem *ps) |
Method for initializing a particles texture coords as part of a connected particle system. | |
Protected Attributes | |
Shape | _shape |
rangef | _sr |
rangef | _ar |
rangev4 | _cr |
osg::ref_ptr< Interpolator > | _si |
osg::ref_ptr< Interpolator > | _ai |
osg::ref_ptr< Interpolator > | _ci |
bool | _alive |
bool | _mustdie |
double | _lifeTime |
float | _radius |
float | _mass |
float | _massinv |
osg::Vec3 | _prev_pos |
osg::Vec3 | _position |
osg::Vec3 | _velocity |
osg::Vec3 | _prev_angle |
osg::Vec3 | _angle |
osg::Vec3 | _angul_arvel |
double | _t0 |
float | _current_size |
float | _current_alpha |
osg::Vec4 | _current_color |
float | _s_tile |
float | _t_tile |
int | _start_tile |
int | _end_tile |
int | _cur_tile |
float | _s_coord |
float | _t_coord |
int | _previousParticle |
int | _nextParticle |
Shape of particles. NOTE: the LINE shape should be used in conjunction with FIXED alignment mode (see ParticleSystem).
osgParticle::Particle::Particle | ( | ) |
Particle::Shape osgParticle::Particle::getShape | ( | ) | const [inline] |
void osgParticle::Particle::setShape | ( | Shape | s | ) | [inline] |
bool osgParticle::Particle::isAlive | ( | ) | const [inline] |
double osgParticle::Particle::getLifeTime | ( | ) | const [inline] |
double osgParticle::Particle::getAge | ( | ) | const [inline] |
const rangef & osgParticle::Particle::getSizeRange | ( | ) | const [inline] |
const rangef & osgParticle::Particle::getAlphaRange | ( | ) | const [inline] |
const rangev4 & osgParticle::Particle::getColorRange | ( | ) | const [inline] |
const Interpolator * osgParticle::Particle::getSizeInterpolator | ( | ) | const [inline] |
const Interpolator * osgParticle::Particle::getAlphaInterpolator | ( | ) | const [inline] |
const Interpolator * osgParticle::Particle::getColorInterpolator | ( | ) | const [inline] |
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.
References _radius.
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.
References _mass.
float osgParticle::Particle::getMassInv | ( | ) | const [inline] |
const osg::Vec3 & osgParticle::Particle::getPosition | ( | ) | const [inline] |
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.
References _velocity.
const osg::Vec3 & osgParticle::Particle::getPreviousPosition | ( | ) | const [inline] |
const osg::Vec3 & osgParticle::Particle::getAngle | ( | ) | const [inline] |
const osg::Vec3 & osgParticle::Particle::getAngularVelocity | ( | ) | const [inline] |
const osg::Vec3 & osgParticle::Particle::getPreviousAngle | ( | ) | const [inline] |
const osg::Vec4& osgParticle::Particle::getCurrentColor | ( | ) | const [inline] |
Get the current color.
float osgParticle::Particle::getCurrentAlpha | ( | ) | const [inline] |
Get the current alpha.
float osgParticle::Particle::getSTexCoord | ( | ) | const [inline] |
Get the s texture coordinate of the bottom left of the particle.
float osgParticle::Particle::getTTexCoord | ( | ) | const [inline] |
Get the t texture coordinate of the bottom left of the particle.
int osgParticle::Particle::getTileS | ( | ) | const [inline] |
int osgParticle::Particle::getTileT | ( | ) | const [inline] |
int osgParticle::Particle::getNumTiles | ( | ) | const [inline] |
Get number of texture tiles.
void osgParticle::Particle::kill | ( | ) | [inline] |
void osgParticle::Particle::setLifeTime | ( | double | t | ) | [inline] |
void osgParticle::Particle::setSizeRange | ( | const rangef & | r | ) | [inline] |
void osgParticle::Particle::setAlphaRange | ( | const rangef & | r | ) | [inline] |
void osgParticle::Particle::setColorRange | ( | const rangev4 & | r | ) | [inline] |
void osgParticle::Particle::setSizeInterpolator | ( | Interpolator * | ri | ) | [inline] |
void osgParticle::Particle::setAlphaInterpolator | ( | Interpolator * | ai | ) | [inline] |
void osgParticle::Particle::setColorInterpolator | ( | Interpolator * | ci | ) | [inline] |
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.
References _radius.
void osgParticle::Particle::setMass | ( | float | m | ) | [inline] |
void osgParticle::Particle::setPosition | ( | const osg::Vec3 & | p | ) | [inline] |
Set the position vector.
References _position.
Referenced by osgParticle::SegmentPlacer::place(), osgParticle::SectorPlacer::place(), osgParticle::PointPlacer::place(), and osgParticle::BoxPlacer::place().
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.
References _velocity.
Referenced by osgParticle::RadialShooter::shoot().
void osgParticle::Particle::addVelocity | ( | const osg::Vec3 & | dv | ) | [inline] |
Add a vector to the velocity vector.
References _velocity.
Referenced by osgParticle::ForceOperator::operate(), and osgParticle::AccelOperator::operate().
void osgParticle::Particle::transformPositionVelocity | ( | const osg::Matrix & | xform | ) | [inline] |
Transform position and velocity vectors by a matrix.
References _position, _velocity, osg::Matrixd::preMult(), and osg::Matrixd::transform3x3().
void osgParticle::Particle::transformPositionVelocity | ( | const osg::Matrix & | xform1, | |
const osg::Matrix & | xform2, | |||
float | r | |||
) | [inline] |
Transform position and velocity vectors by a combination of two matrices.
References _position, _velocity, osg::Matrixd::preMult(), and osg::Matrixd::transform3x3().
void osgParticle::Particle::setAngle | ( | const osg::Vec3 & | a | ) | [inline] |
void osgParticle::Particle::setAngularVelocity | ( | const osg::Vec3 & | v | ) | [inline] |
Set the angular velocity vector. Components x, y and z are angles of rotation around the respective axis (in radians).
References _angul_arvel.
Referenced by osgParticle::RadialShooter::shoot().
void osgParticle::Particle::addAngularVelocity | ( | const osg::Vec3 & | dv | ) | [inline] |
Add a vector to the angular velocity vector.
References _angul_arvel.
Referenced by osgParticle::AngularAccelOperator::operate().
void osgParticle::Particle::transformAngleVelocity | ( | const osg::Matrix & | xform | ) | [inline] |
Transform angle and angularVelocity vectors by a matrix.
References _angle, _angul_arvel, and osg::Matrixd::preMult().
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).
void osgParticle::Particle::beginRender | ( | osg::GLBeginEndAdapter * | gl | ) | const [inline] |
Perform some pre-rendering tasks. Called automatically by particle systems.
References _shape, osg::GLBeginEndAdapter::Begin(), LINE, POINT, and QUAD.
void osgParticle::Particle::render | ( | osg::GLBeginEndAdapter * | gl, | |
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::endRender | ( | osg::GLBeginEndAdapter * | gl | ) | const [inline] |
Perform some post-rendering tasks. Called automatically by particle systems.
References _shape, osg::GLBeginEndAdapter::End(), LINE, POINT, and QUAD.
float osgParticle::Particle::getCurrentSize | ( | ) | const [inline] |
Get the current (interpolated) polygon size. Valid only after the first call to update().
References _current_size.
void osgParticle::Particle::setTextureTileRange | ( | int | sTile, | |
int | tTile, | |||
int | startTile, | |||
int | endTile | |||
) | [inline] |
Specify how the particle texture is tiled. All tiles in the given range are sequentially displayed during the lifetime of the particle. When no range is given, all tiles are displayed during the lifetime.
References _end_tile, _s_tile, _start_tile, and _t_tile.
Referenced by setTextureTile().
void osgParticle::Particle::setTextureTile | ( | int | sTile, | |
int | tTile, | |||
int | end = -1 | |||
) | [inline] |
void osgParticle::Particle::setPreviousParticle | ( | int | previous | ) | [inline] |
Set the previous particle.
int osgParticle::Particle::getPreviousParticle | ( | ) | const [inline] |
Get the previous particle.
void osgParticle::Particle::setNextParticle | ( | int | next | ) | [inline] |
Set the next particle.
int osgParticle::Particle::getNextParticle | ( | ) | const [inline] |
Get the const next particle.
void osgParticle::Particle::setUpTexCoordsAsPartOfConnectedParticleSystem | ( | ParticleSystem * | ps | ) |
Method for initializing a particles texture coords as part of a connected particle system.
Shape osgParticle::Particle::_shape [protected] |
Referenced by beginRender(), endRender(), getShape(), and setShape().
rangef osgParticle::Particle::_sr [protected] |
Referenced by getSizeRange(), and setSizeRange().
rangef osgParticle::Particle::_ar [protected] |
Referenced by getAlphaRange(), and setAlphaRange().
rangev4 osgParticle::Particle::_cr [protected] |
Referenced by getColorRange(), and setColorRange().
osg::ref_ptr<Interpolator> osgParticle::Particle::_si [protected] |
Referenced by getSizeInterpolator(), and setSizeInterpolator().
osg::ref_ptr<Interpolator> osgParticle::Particle::_ai [protected] |
Referenced by getAlphaInterpolator(), and setAlphaInterpolator().
osg::ref_ptr<Interpolator> osgParticle::Particle::_ci [protected] |
Referenced by getColorInterpolator(), and setColorInterpolator().
bool osgParticle::Particle::_alive [protected] |
Referenced by isAlive().
bool osgParticle::Particle::_mustdie [protected] |
Referenced by kill().
double osgParticle::Particle::_lifeTime [protected] |
Referenced by getLifeTime(), and setLifeTime().
float osgParticle::Particle::_radius [protected] |
Referenced by getRadius(), and setRadius().
float osgParticle::Particle::_mass [protected] |
float osgParticle::Particle::_massinv [protected] |
Referenced by getMassInv(), and setMass().
osg::Vec3 osgParticle::Particle::_prev_pos [protected] |
Referenced by getPreviousPosition().
osg::Vec3 osgParticle::Particle::_position [protected] |
Referenced by getPosition(), setPosition(), and transformPositionVelocity().
osg::Vec3 osgParticle::Particle::_velocity [protected] |
Referenced by addVelocity(), getVelocity(), setVelocity(), and transformPositionVelocity().
osg::Vec3 osgParticle::Particle::_prev_angle [protected] |
Referenced by getPreviousAngle().
osg::Vec3 osgParticle::Particle::_angle [protected] |
Referenced by getAngle(), setAngle(), and transformAngleVelocity().
osg::Vec3 osgParticle::Particle::_angul_arvel [protected] |
Referenced by addAngularVelocity(), getAngularVelocity(), setAngularVelocity(), and transformAngleVelocity().
double osgParticle::Particle::_t0 [protected] |
Referenced by getAge().
float osgParticle::Particle::_current_size [protected] |
Referenced by getCurrentSize().
float osgParticle::Particle::_current_alpha [protected] |
osg::Vec4 osgParticle::Particle::_current_color [protected] |
float osgParticle::Particle::_s_tile [protected] |
Referenced by getTileS(), and setTextureTileRange().
float osgParticle::Particle::_t_tile [protected] |
Referenced by getTileT(), and setTextureTileRange().
int osgParticle::Particle::_start_tile [protected] |
Referenced by setTextureTileRange().
int osgParticle::Particle::_end_tile [protected] |
Referenced by setTextureTileRange().
int osgParticle::Particle::_cur_tile [protected] |
float osgParticle::Particle::_s_coord [protected] |
float osgParticle::Particle::_t_coord [protected] |
int osgParticle::Particle::_previousParticle [protected] |
int osgParticle::Particle::_nextParticle [protected] |