VR-Forces 4.1.1 Class Documentation
List of all members | Public Member Functions | Protected Member Functions | Private Attributes
makVrv::DtTacticalSmokeEffect Class Reference

A particle system for creating a single puff of smoke with a normal (or Gaussian) distribution of particles to simulate a tactical smoke cloud. More...

Inheritance diagram for makVrv::DtTacticalSmokeEffect:
Inheritance graph
[legend]

Public Member Functions

 DtTacticalSmokeEffect ()
 Default constructor.
 DtTacticalSmokeEffect (const DtTacticalSmokeEffect &copy, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
 Copy constructor.
 META_Node (makVrv, DtTacticalSmokeEffect)
osg::MatrixTransform * particleTransform ()
 Get the transform for the particle system.
const osg::MatrixTransform * particleTransform () const
DtTacticalSmokeEmitterparticleEmitter ()
 Get the particle emitter.
const DtTacticalSmokeEmitterparticleEmitter () const
osgParticle::Shooter * particleShooter ()
 Get the particle emitter shooter.
const osgParticle::Shooter * particleShooter () const
osgParticle::Placer * particlePlacer ()
 Get the particle emitter placer.
const osgParticle::Placer * particlePlacer () const
osgParticle::Counter * particleCounter ()
 Get the particle emitter counter.
const osgParticle::Counter * particleCounter () const
osgParticle::ParticleSystem * particleSystem ()
 Get the particle system.
const osgParticle::ParticleSystem * particleSystem () const
osgParticle::Particle & particleTemplate ()
 Get the particle template.
const osgParticle::Particle & particleTemplate () const
DtTranslateOperatorparticleOperator ()
 Get the particle operator for simple wind.
const DtTranslateOperatorparticleOperator () const
void setParticleSpeed (double speed)
 Set the constant speed of particles.
void setParticleLifetime (double life)
 Set the constant lifetime of particles.
void setOneSigmaDistance (int puffIndex, const osg::Vec3d &dist)
 Set the one-sigma distance per orthogonal direction.
void setDensity (int puffIndex, double dens)
 Set the density of the tactical smoke.
void setPlacement (int puffIndex, const osg::Vec3d &pos)
 Set the placement position particles are emitted from for a puff.
void setEmitterLifetime (double life)
 Set the lifetime of the emitter.
void setParticleSizeRange (double isz, double fsz)
 Set the particle size range.
void setParticleRotationRange (double mn, double mx)
 Set the particle rotation range.
void setParticleColorRange (const osg::Vec4 &icl, const osg::Vec4 &fcl)
 Set the particle color range.
void setParticleAlphaMultiplier (double alpha)
 Set the initial particle alpha value multiplier.
void setIntensityRange (double mn, double mx)
 Set the intensity range.
void setWind (const osg::Vec3d &wnd)
 Set the wind direction and magnitude.
void setTexture (const std::string &txt)
 Set the filename of the texture used on each particle.
void start ()
 Start emitting particles.
void stop ()
 Stop emitting particles.
void pause ()
 Freeze particle generation.
void resume ()
 Resume particle generation.
void setDefaults ()
 Set the system to default values.
virtual void traverse (osg::NodeVisitor &nv)
 Interrupt CullVisitors to update the internal transforms.

Protected Member Functions

void initialize ()
 Set up the particle system.
virtual ~DtTacticalSmokeEffect ()
 Virtual destructor.

Private Attributes

osg::ref_ptr
< osg::MatrixTransform > 
myParticleTransform
osg::ref_ptr
< osgParticle::ParticleSystem > 
myParticleSystem
osg::ref_ptr
< DtTacticalSmokeEmitter
myEmitter
osg::ref_ptr< DtTranslateOperatormyWindOperator
bool myTransformIsSet
std::string myTexture

Detailed Description

A particle system for creating a single puff of smoke with a normal (or Gaussian) distribution of particles to simulate a tactical smoke cloud.

This class provides a facade around a single osgParticle class hierarchy. This class is designed specifically for tactical smoke effects which require augmenting an effect over time, which usual effect systems do not handle. This class defines a smoke cloud 'puff' with a Gaussian distribution of particles, and the cloud can be resized and and deformed over the lifetime of the effect without having to stop and restart the effect. The distribution of particles is defined by a custom shooter attached to the particle emitter.

See Also
makVrv::DtParticleEffect for multiple particle systems support.

Constructor & Destructor Documentation

makVrv::DtTacticalSmokeEffect::DtTacticalSmokeEffect ( )

Default constructor.

makVrv::DtTacticalSmokeEffect::DtTacticalSmokeEffect ( const DtTacticalSmokeEffect copy,
const osg::CopyOp &  copyop = osg::CopyOp::SHALLOW_COPY 
)

Copy constructor.

Parameters
[in]copyis the object to copy from.
[in]copyopis a flag describing the type of copy.
virtual makVrv::DtTacticalSmokeEffect::~DtTacticalSmokeEffect ( )
protectedvirtual

Virtual destructor.

Member Function Documentation

makVrv::DtTacticalSmokeEffect::META_Node ( makVrv  ,
DtTacticalSmokeEffect   
)
osg::MatrixTransform* makVrv::DtTacticalSmokeEffect::particleTransform ( )

Get the transform for the particle system.

Returns
A pointer to the particle system transform.
const osg::MatrixTransform* makVrv::DtTacticalSmokeEffect::particleTransform ( ) const
DtTacticalSmokeEmitter* makVrv::DtTacticalSmokeEffect::particleEmitter ( )

Get the particle emitter.

Returns
A pointer to the particle emitter.
const DtTacticalSmokeEmitter* makVrv::DtTacticalSmokeEffect::particleEmitter ( ) const
osgParticle::Shooter* makVrv::DtTacticalSmokeEffect::particleShooter ( )

Get the particle emitter shooter.

Returns
A pointer to the particle emitter shooter.
const osgParticle::Shooter* makVrv::DtTacticalSmokeEffect::particleShooter ( ) const
osgParticle::Placer* makVrv::DtTacticalSmokeEffect::particlePlacer ( )

Get the particle emitter placer.

Returns
A pointer to the particle emitter placer.
const osgParticle::Placer* makVrv::DtTacticalSmokeEffect::particlePlacer ( ) const
osgParticle::Counter* makVrv::DtTacticalSmokeEffect::particleCounter ( )

Get the particle emitter counter.

Returns
A pointer to the particle emitter counter.
const osgParticle::Counter* makVrv::DtTacticalSmokeEffect::particleCounter ( ) const
osgParticle::ParticleSystem* makVrv::DtTacticalSmokeEffect::particleSystem ( )

Get the particle system.

Returns
A pointer to the particle system.
const osgParticle::ParticleSystem* makVrv::DtTacticalSmokeEffect::particleSystem ( ) const
osgParticle::Particle& makVrv::DtTacticalSmokeEffect::particleTemplate ( )

Get the particle template.

Returns
A pointer to the template particle.
const osgParticle::Particle& makVrv::DtTacticalSmokeEffect::particleTemplate ( ) const
DtTranslateOperator* makVrv::DtTacticalSmokeEffect::particleOperator ( )

Get the particle operator for simple wind.

Returns
A pointer to the particle operator.
const DtTranslateOperator* makVrv::DtTacticalSmokeEffect::particleOperator ( ) const
void makVrv::DtTacticalSmokeEffect::setParticleSpeed ( double  speed)

Set the constant speed of particles.

Parameters
[in]speedis the speed in meter-per-second, default 0.25.
Note
Calling this function will cause all particles to be shot with a consistent speed and the distribution of particles will be a result of a random particle lifetime according to the formula: lifetime = (| rand | * sigma) / speed where rand is a Gaussian distribution.
Values of zero or less are ignored.
See Also
setParticleLifetime()
void makVrv::DtTacticalSmokeEffect::setParticleLifetime ( double  life)

Set the constant lifetime of particles.

Parameters
[in]lifeis the lifetime in second, default 30.0.
Note
Calling this function will cause all particles to have a consistent lifetime and the distribution of particles will be a result of a random particle speeds according to the formula: speed = (| rand | * sigma) / lifetime where rand is a Gaussian distribution.
Values of zero or less are ignored.
See Also
setParticleSpeed()
void makVrv::DtTacticalSmokeEffect::setOneSigmaDistance ( int  puffIndex,
const osg::Vec3d &  dist 
)

Set the one-sigma distance per orthogonal direction.

Parameters
[in]puffIndexis the index of the puff for sigma-distances.
[in]distis the distance in each direction where the probability of particle distribution within that distance is one-sigma (68.3%), default is Vec3d(1.0, 1.0, 1.0).
void makVrv::DtTacticalSmokeEffect::setDensity ( int  puffIndex,
double  dens 
)

Set the density of the tactical smoke.

Density is simulated by the starting alpha value of the particles.

Parameters
[in]puffIndexis the index of the puff for density changes.
[in]densis the density of smoke, default 1.0.
void makVrv::DtTacticalSmokeEffect::setPlacement ( int  puffIndex,
const osg::Vec3d &  pos 
)

Set the placement position particles are emitted from for a puff.

Parameters
[in]puffIndexis the index of the placement
[in]posis the position for the placer.
void makVrv::DtTacticalSmokeEffect::setEmitterLifetime ( double  life)

Set the lifetime of the emitter.

Parameters
[in]lifeis the lifetime in second, default is 0.0.
Note
Setting the lifetime to zero or less will make the emitter continuous.
void makVrv::DtTacticalSmokeEffect::setParticleSizeRange ( double  isz,
double  fsz 
)

Set the particle size range.

The particles will each change size over their lifetime from an initial size to a final size.

Parameters
[in]iszis the initial size of particles, default 1.0.
[in]fszis the final size of particles, default 1.0.
void makVrv::DtTacticalSmokeEffect::setParticleRotationRange ( double  mn,
double  mx 
)

Set the particle rotation range.

The particles will each continuously rotate over their lifetime at a constant rate. The range defines the boundaries of the randomly chosen angular-velocity. Angular-velocity is defined in degrees.

Parameters
[in]mnis the lower boundary of the range, default -10.0.
[in]mxis the upper boundary of the range, default 10.0.
void makVrv::DtTacticalSmokeEffect::setParticleColorRange ( const osg::Vec4 &  icl,
const osg::Vec4 &  fcl 
)

Set the particle color range.

The particles will each change color over their lifetime from an initial color to a final color.

Parameters
[in]iclis the initial color, default (1.0, 1.0, 1.0, 1.0).
[in]fclis the final color, default (1.0, 1.0, 1.0, 1.0).
void makVrv::DtTacticalSmokeEffect::setParticleAlphaMultiplier ( double  alpha)

Set the initial particle alpha value multiplier.

This is multiplied to the starting alpha value of the particles, the ending value is always zero. The alpha value should be a normalized value from zero to one.

Parameters
[in]alphais the starting alpha value, default 1.0.
void makVrv::DtTacticalSmokeEffect::setIntensityRange ( double  mn,
double  mx 
)

Set the intensity range.

This range produces a random rate of particle generation between a lower and upper bound.

Parameters
[in]mnis the lower boundary of the range, default 25.0.
[in]mxis the upper boundary of the range, default 25.0.
void makVrv::DtTacticalSmokeEffect::setWind ( const osg::Vec3d &  wnd)

Set the wind direction and magnitude.

Parameters
[in]wndis the direction and magnitude of wind in meters-per-second, default is (0.0, 0.0, 0.0).
void makVrv::DtTacticalSmokeEffect::setTexture ( const std::string &  txt)

Set the filename of the texture used on each particle.

Parameters
[in]txtis the texture filename.
void makVrv::DtTacticalSmokeEffect::start ( )

Start emitting particles.

See Also
stop(), pause() and resume()
void makVrv::DtTacticalSmokeEffect::stop ( )

Stop emitting particles.

See Also
start(), pause() and resume()
void makVrv::DtTacticalSmokeEffect::pause ( )

Freeze particle generation.

See Also
start(), stop() and resume()
void makVrv::DtTacticalSmokeEffect::resume ( )

Resume particle generation.

See Also
start(), stop() and pause()
void makVrv::DtTacticalSmokeEffect::setDefaults ( )

Set the system to default values.

virtual void makVrv::DtTacticalSmokeEffect::traverse ( osg::NodeVisitor &  nv)
virtual

Interrupt CullVisitors to update the internal transforms.

Parameters
[in]nvis the node-visitor for the current frame.
Note
Do not call directly.
void makVrv::DtTacticalSmokeEffect::initialize ( )
protected

Set up the particle system.

Member Data Documentation

osg::ref_ptr<osg::MatrixTransform> makVrv::DtTacticalSmokeEffect::myParticleTransform
private
osg::ref_ptr<osgParticle::ParticleSystem> makVrv::DtTacticalSmokeEffect::myParticleSystem
private
osg::ref_ptr<DtTacticalSmokeEmitter> makVrv::DtTacticalSmokeEffect::myEmitter
private
osg::ref_ptr<DtTranslateOperator> makVrv::DtTacticalSmokeEffect::myWindOperator
private
bool makVrv::DtTacticalSmokeEffect::myTransformIsSet
private
std::string makVrv::DtTacticalSmokeEffect::myTexture
private

The documentation for this class was generated from the following file:

Document ID: Generated on Mon Apr 8 19:24:01 EDT 2013 from SVN revision 125877
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)