OSG
3.4.0
|
#include <Particle.h>
Public Types | |
enum | { INVALID_INDEX = -1 } |
enum | Shape { POINT, QUAD, QUAD_TRIANGLESTRIP, HEXAGON, LINE, USER } |
Public Member Functions | |
Particle () | |
Shape | getShape () const |
Get the shape of the particle. More... | |
void | setShape (Shape s) |
Set the shape of the particle. More... | |
bool | isAlive () const |
Get whether the particle is still alive. More... | |
double | getLifeTime () const |
Get the life time of the particle (in seconds). More... | |
double | getAge () const |
Get the age of the particle (in seconds). More... | |
const rangef & | getSizeRange () const |
Get the minimum and maximum values for polygon size. More... | |
const rangef & | getAlphaRange () const |
Get the minimum and maximum values for alpha. More... | |
const rangev4 & | getColorRange () const |
Get the minimum and maximum values for color. More... | |
const Interpolator * | getSizeInterpolator () const |
Get the interpolator for computing the size of polygons. More... | |
const Interpolator * | getAlphaInterpolator () const |
Get the interpolator for computing alpha values. More... | |
const Interpolator * | getColorInterpolator () const |
Get the interpolator for computing color values. More... | |
float | getRadius () const |
float | getMass () const |
float | getMassInv () const |
Get 1 / getMass() . More... | |
const osg::Vec3 & | getPosition () const |
Get the position vector. More... | |
const osg::Vec3 & | getVelocity () const |
const osg::Vec3 & | getPreviousPosition () const |
Get the previous position (the position before last update). More... | |
const osg::Vec3 & | getAngle () const |
Get the angle vector. More... | |
const osg::Vec3 & | getAngularVelocity () const |
Get the rotational velocity vector. More... | |
const osg::Vec3 & | getPreviousAngle () const |
Get the previous angle vector. More... | |
const osg::Vec4 & | getCurrentColor () const |
Get the current color. More... | |
float | getCurrentAlpha () const |
Get the current alpha. More... | |
float | getSTexCoord () const |
Get the s texture coordinate of the bottom left of the particle. More... | |
float | getTTexCoord () const |
Get the t texture coordinate of the bottom left of the particle. More... | |
int | getTileS () const |
Get width of texture tile. More... | |
int | getTileT () const |
Get height of texture tile. More... | |
int | getNumTiles () const |
Get number of texture tiles. More... | |
void | kill () |
void | setLifeTime (double t) |
Set the life time of the particle. More... | |
void | setSizeRange (const rangef &r) |
Set the minimum and maximum values for polygon size. More... | |
void | setAlphaRange (const rangef &r) |
Set the minimum and maximum values for alpha. More... | |
void | setColorRange (const rangev4 &r) |
Set the minimum and maximum values for color. More... | |
void | setSizeInterpolator (Interpolator *ri) |
Set the interpolator for computing size values. More... | |
void | setAlphaInterpolator (Interpolator *ai) |
Set the interpolator for computing alpha values. More... | |
void | setColorInterpolator (Interpolator *ci) |
Set the interpolator for computing color values. More... | |
void | setRadius (float r) |
void | setMass (float m) |
void | setPosition (const osg::Vec3 &p) |
Set the position vector. More... | |
void | setVelocity (const osg::Vec3 &v) |
void | addVelocity (const osg::Vec3 &dv) |
Add a vector to the velocity vector. More... | |
void | transformPositionVelocity (const osg::Matrix &xform) |
Transform position and velocity vectors by a matrix. More... | |
void | transformPositionVelocity (const osg::Matrix &xform1, const osg::Matrix &xform2, float r) |
Transform position and velocity vectors by a combination of two matrices. More... | |
void | setAngle (const osg::Vec3 &a) |
Set the angle vector. More... | |
void | setAngularVelocity (const osg::Vec3 &v) |
void | addAngularVelocity (const osg::Vec3 &dv) |
Add a vector to the angular velocity vector. More... | |
void | transformAngleVelocity (const osg::Matrix &xform) |
Transform angle and angularVelocity vectors by a matrix. More... | |
bool | update (double dt, bool onlyTimeStamp) |
void | beginRender (osg::GLBeginEndAdapter *gl) const |
Perform some pre-rendering tasks. Called automatically by particle systems. More... | |
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. More... | |
void | render (osg::RenderInfo &renderInfo, const osg::Vec3 &xpos, const osg::Vec3 &xrot) const |
Render the particle with user-defined drawable. More... | |
void | endRender (osg::GLBeginEndAdapter *gl) const |
Perform some post-rendering tasks. Called automatically by particle systems. More... | |
float | getCurrentSize () const |
Get the current (interpolated) polygon size. Valid only after the first call to update(). More... | |
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. More... | |
int | getStartTile () const |
int | getEndTile () const |
void | setPreviousParticle (int previous) |
Set the previous particle. More... | |
int | getPreviousParticle () const |
Get the previous particle. More... | |
void | setNextParticle (int next) |
Set the next particle. More... | |
int | getNextParticle () const |
Get the const next particle. More... | |
void | setDepth (double d) |
Set the depth of the particle. More... | |
double | getDepth () const |
Get the depth of the particle. More... | |
void | setDrawable (osg::Drawable *d) |
Set the user-defined particle drawable. More... | |
osg::Drawable * | getDrawable () const |
Get the user-defined particle drawable. More... | |
bool | operator< (const Particle &P) const |
Sorting operator. More... | |
void | setUpTexCoordsAsPartOfConnectedParticleSystem (ParticleSystem *ps) |
Method for initializing a particles texture coords as part of a connected particle system. More... | |
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 | _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 | _alive |
float | _current_size |
float | _current_alpha |
osg::Vec3 | _base_prop |
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 |
double | _depth |
osg::ref_ptr< osg::Drawable > | _drawable |
Friends | |
class | ParticleSystem |
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.
Definition at line 50 of file Particle.h.
anonymous enum |
Enumerator | |
---|---|
INVALID_INDEX |
Definition at line 54 of file Particle.h.
Shape of particles. NOTE: the LINE shape should be used in conjunction with FIXED alignment mode (see ParticleSystem).
Enumerator | |
---|---|
POINT | |
QUAD | |
QUAD_TRIANGLESTRIP | |
HEXAGON | |
LINE | |
USER |
Definition at line 63 of file Particle.h.
osgParticle::Particle::Particle | ( | ) |
|
inline |
Add a vector to the angular velocity vector.
Definition at line 539 of file Particle.h.
|
inline |
Add a vector to the velocity vector.
Definition at line 507 of file Particle.h.
|
inline |
Perform some pre-rendering tasks. Called automatically by particle systems.
Definition at line 572 of file Particle.h.
|
inline |
Perform some post-rendering tasks. Called automatically by particle systems.
Definition at line 589 of file Particle.h.
|
inline |
Get the age of the particle (in seconds).
Definition at line 372 of file Particle.h.
|
inline |
Get the interpolator for computing alpha values.
Definition at line 407 of file Particle.h.
|
inline |
Get the minimum and maximum values for alpha.
Definition at line 392 of file Particle.h.
|
inline |
Get the angle vector.
Definition at line 432 of file Particle.h.
|
inline |
Get the rotational velocity vector.
Definition at line 437 of file Particle.h.
|
inline |
Get the interpolator for computing color values.
Definition at line 412 of file Particle.h.
|
inline |
Get the minimum and maximum values for color.
Definition at line 397 of file Particle.h.
|
inline |
Get the current alpha.
Definition at line 145 of file Particle.h.
|
inline |
Get the current color.
Definition at line 142 of file Particle.h.
|
inline |
Get the current (interpolated) polygon size. Valid only after the first call to update().
Definition at line 602 of file Particle.h.
|
inline |
Get the depth of the particle.
Definition at line 283 of file Particle.h.
|
inline |
Get the user-defined particle drawable.
Definition at line 289 of file Particle.h.
|
inline |
Definition at line 642 of file Particle.h.
|
inline |
Get the life time of the particle (in seconds).
Definition at line 367 of file Particle.h.
|
inline |
Get the mass of the particle. For built-in operators to work correctly, remember that the mass is expressed in kg.
Definition at line 556 of file Particle.h.
|
inline |
Get 1 / getMass()
.
Definition at line 561 of file Particle.h.
|
inline |
Get the const next particle.
Definition at line 277 of file Particle.h.
|
inline |
Get number of texture tiles.
Definition at line 160 of file Particle.h.
|
inline |
Get the position vector.
Definition at line 417 of file Particle.h.
|
inline |
Get the previous angle vector.
Definition at line 442 of file Particle.h.
|
inline |
Get the previous particle.
Definition at line 271 of file Particle.h.
|
inline |
Get the previous position (the position before last update).
Definition at line 427 of file Particle.h.
|
inline |
Get the physical radius of the particle. For built-in operators to work correctly, lengths must be expressed in meters.
Definition at line 377 of file Particle.h.
|
inline |
Get the shape of the particle.
Definition at line 352 of file Particle.h.
|
inline |
Get the interpolator for computing the size of polygons.
Definition at line 402 of file Particle.h.
|
inline |
Get the minimum and maximum values for polygon size.
Definition at line 387 of file Particle.h.
|
inline |
Definition at line 637 of file Particle.h.
|
inline |
Get the s texture coordinate of the bottom left of the particle.
Definition at line 148 of file Particle.h.
|
inline |
Get width of texture tile.
Definition at line 447 of file Particle.h.
|
inline |
Get height of texture tile.
Definition at line 452 of file Particle.h.
|
inline |
Get the t texture coordinate of the bottom left of the particle.
Definition at line 151 of file Particle.h.
|
inline |
Get the velocity vector. For built-in operators to work correctly, remember that velocity components are expressed in meters per second.
Definition at line 422 of file Particle.h.
|
inline |
Get whether the particle is still alive.
Definition at line 362 of file Particle.h.
|
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.
Definition at line 457 of file Particle.h.
|
inline |
Sorting operator.
Definition at line 292 of file Particle.h.
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::render | ( | osg::RenderInfo & | renderInfo, |
const osg::Vec3 & | xpos, | ||
const osg::Vec3 & | xrot | ||
) | const |
Render the particle with user-defined drawable.
|
inline |
Set the interpolator for computing alpha values.
Definition at line 487 of file Particle.h.
|
inline |
Set the minimum and maximum values for alpha.
Definition at line 472 of file Particle.h.
|
inline |
Set the angle vector.
Definition at line 529 of file Particle.h.
|
inline |
Set the angular velocity vector. Components x, y and z are angles of rotation around the respective axis (in radians).
Definition at line 534 of file Particle.h.
|
inline |
Set the interpolator for computing color values.
Definition at line 492 of file Particle.h.
|
inline |
Set the minimum and maximum values for color.
Definition at line 477 of file Particle.h.
|
inline |
Set the depth of the particle.
Definition at line 280 of file Particle.h.
|
inline |
Set the user-defined particle drawable.
Definition at line 286 of file Particle.h.
|
inline |
Set the life time of the particle.
Definition at line 462 of file Particle.h.
|
inline |
Set the mass of the particle. For built-in operators to work correctly, remember that the mass is expressed in kg.
Definition at line 566 of file Particle.h.
|
inline |
Set the next particle.
Definition at line 274 of file Particle.h.
|
inline |
Set the position vector.
Definition at line 497 of file Particle.h.
|
inline |
Set the previous particle.
Definition at line 268 of file Particle.h.
|
inline |
Set the physical radius of the particle. For built-in operators to work correctly, lengths must be expressed in meters.
Definition at line 382 of file Particle.h.
|
inline |
Set the shape of the particle.
Definition at line 357 of file Particle.h.
|
inline |
Set the interpolator for computing size values.
Definition at line 482 of file Particle.h.
|
inline |
Set the minimum and maximum values for polygon size.
Definition at line 467 of file Particle.h.
|
inline |
Same as above, range starts at 0 and ends at end.
Definition at line 608 of file Particle.h.
|
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.
Definition at line 613 of file Particle.h.
void osgParticle::Particle::setUpTexCoordsAsPartOfConnectedParticleSystem | ( | ParticleSystem * | ps | ) |
Method for initializing a particles texture coords as part of a connected particle system.
|
inline |
Set the velocity vector. For built-in operators to work correctly, remember that velocity components are expressed in meters per second.
Definition at line 502 of file Particle.h.
|
inline |
Transform angle and angularVelocity vectors by a matrix.
Definition at line 544 of file Particle.h.
|
inline |
Transform position and velocity vectors by a matrix.
Definition at line 512 of file Particle.h.
|
inline |
Transform position and velocity vectors by a combination of two matrices.
Definition at line 518 of file Particle.h.
bool osgParticle::Particle::update | ( | double | dt, |
bool | onlyTimeStamp | ||
) |
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).
|
friend |
Definition at line 51 of file Particle.h.
|
protected |
Definition at line 306 of file Particle.h.
|
protected |
Definition at line 325 of file Particle.h.
|
protected |
Definition at line 320 of file Particle.h.
|
protected |
Definition at line 321 of file Particle.h.
|
protected |
Definition at line 302 of file Particle.h.
|
protected |
Definition at line 328 of file Particle.h.
|
protected |
Definition at line 307 of file Particle.h.
|
protected |
Definition at line 303 of file Particle.h.
|
protected |
Definition at line 335 of file Particle.h.
|
protected |
Definition at line 327 of file Particle.h.
|
protected |
Definition at line 329 of file Particle.h.
|
protected |
Definition at line 326 of file Particle.h.
|
protected |
Definition at line 344 of file Particle.h.
|
protected |
Definition at line 347 of file Particle.h.
|
protected |
Definition at line 334 of file Particle.h.
|
protected |
Definition at line 310 of file Particle.h.
|
protected |
Definition at line 313 of file Particle.h.
|
protected |
Definition at line 314 of file Particle.h.
|
protected |
Definition at line 309 of file Particle.h.
|
protected |
Definition at line 341 of file Particle.h.
|
protected |
Definition at line 316 of file Particle.h.
|
protected |
Definition at line 319 of file Particle.h.
|
protected |
Definition at line 315 of file Particle.h.
|
protected |
Definition at line 340 of file Particle.h.
|
protected |
Definition at line 312 of file Particle.h.
|
protected |
Definition at line 336 of file Particle.h.
|
protected |
Definition at line 331 of file Particle.h.
|
protected |
Definition at line 299 of file Particle.h.
|
protected |
Definition at line 305 of file Particle.h.
|
protected |
Definition at line 301 of file Particle.h.
|
protected |
Definition at line 333 of file Particle.h.
|
protected |
Definition at line 323 of file Particle.h.
|
protected |
Definition at line 337 of file Particle.h.
|
protected |
Definition at line 332 of file Particle.h.
|
protected |
Definition at line 317 of file Particle.h.