iMSTK
Interactive Medical Simulation Toolkit
|
Animation method for rendering particles Common use cases include smoke and fire. More...
#include <imstkRenderParticleEmitter.h>
Public Types | |
enum | Shape { Cube } |
Shape of emitter. | |
enum | Mode { Mode::Continuous, Mode::Burst } |
Mode of emitter. More... | |
Public Member Functions | |
RenderParticleEmitter (std::shared_ptr< Geometry > geometry, const float time=3000.0f, Mode mode=Mode::Continuous) | |
Constructor. | |
virtual void | setGeometry (std::shared_ptr< Geometry > renderParticles) |
Set animation geometry. More... | |
RenderParticleEmitter::Mode | getEmitterMode () const |
Get mode of emitter. More... | |
void | setEmitterSize (const float size) |
Set size of emitter. More... | |
void | setInitialVelocityRange (const Vec3f minDirection, const Vec3f maxDirection, const float minSpeed, const float maxSpeed, const float minRotationSpeed, const float maxRotationSpeed) |
Set velocity range This functions sets minimum and maximum rotation values for determining the initial trajectory of the particles. The values are randomly selected (according to a uniform distribution) between the min and max values. If the values are the same, then the particle direction will not behave randomly. More... | |
bool | addKeyFrame (RenderParticleKeyFrame keyFrame) |
Add keyframe to particle emitter. More... | |
RenderParticleKeyFrame * | getStartKeyFrame () |
Get start and end frames. | |
RenderParticleKeyFrame * | getEndKeyFrame () |
std::vector< RenderParticleKeyFrame > & | getKeyFrames () |
Get key frames. More... | |
virtual void | reset () |
Reset the emitter Only works for burst particles. | |
virtual void | update () |
Update. | |
![]() | |
AnimationModel (std::shared_ptr< Geometry > geometry) | |
std::shared_ptr< Geometry > | getGeometry () |
Get/set geometry. | |
Protected Member Functions | |
void | initializeParticles () |
Initialize particles. | |
void | interpolateColor (Color &destination, const Color &sourceA, const Color &sourceB, const float alpha) |
Interpolate color. | |
void | emitParticle (std::unique_ptr< RenderParticle > &particle) |
Emit particle. | |
float | getRandomNormalizedFloat () |
Get uniformly-distributed float. More... | |
Protected Attributes | |
std::vector< RenderParticleKeyFrame > | m_keyFrames |
Particle keyframes. | |
RenderParticleEmitter::Mode | m_mode = RenderParticleEmitter::Mode::Continuous |
RenderParticleEmitter::Shape | m_shape = RenderParticleEmitter::Shape::Cube |
Vec3f | m_minDirection |
Vec3f | m_maxDirection |
float | m_minSpeed |
float | m_maxSpeed |
float | m_minRotationSpeed |
float | m_maxRotationSpeed |
float | m_time |
total time for particle system | |
float | m_emitTime |
std::unique_ptr< StopWatch > | m_stopWatch |
double | m_lastUpdateTime = 0.0 |
bool | m_started = false |
float | m_emitterSize = 1.0f |
const int | c_maxNumKeyFrames = 16 |
Maximum key frames. | |
std::shared_ptr< Geometry > | m_animationGeometry = nullptr |
std::vector< std::unique_ptr< RenderParticle > > * | m_particles |
![]() | |
std::shared_ptr< Geometry > | m_geometry = nullptr |
Animation method for rendering particles Common use cases include smoke and fire.
Definition at line 38 of file imstkRenderParticleEmitter.h.
|
strong |
Mode of emitter.
Enumerator | |
---|---|
Continuous | Emitter continuously releases/recycles particles. |
Burst | Emitter releases particles once until manually reset. |
Definition at line 52 of file imstkRenderParticleEmitter.h.
bool imstk::RenderParticleEmitter::addKeyFrame | ( | RenderParticleKeyFrame | keyFrame | ) |
Add keyframe to particle emitter.
keyFrame | key frame to add |
Definition at line 81 of file imstkRenderParticleEmitter.cpp.
RenderParticleEmitter::Mode imstk::RenderParticleEmitter::getEmitterMode | ( | ) | const |
Get mode of emitter.
Definition at line 51 of file imstkRenderParticleEmitter.cpp.
std::vector< RenderParticleKeyFrame > & imstk::RenderParticleEmitter::getKeyFrames | ( | ) |
Get key frames.
Definition at line 125 of file imstkRenderParticleEmitter.cpp.
|
protected |
Get uniformly-distributed float.
Definition at line 291 of file imstkRenderParticleEmitter.cpp.
void imstk::RenderParticleEmitter::setEmitterSize | ( | const float | size | ) |
Set size of emitter.
size | Width of emitter |
Definition at line 57 of file imstkRenderParticleEmitter.cpp.
|
virtual |
Set animation geometry.
renderParticles | particles for rendering |
Reimplemented from imstk::AnimationModel.
Definition at line 41 of file imstkRenderParticleEmitter.cpp.
void imstk::RenderParticleEmitter::setInitialVelocityRange | ( | const Vec3f | minDirection, |
const Vec3f | maxDirection, | ||
const float | minSpeed, | ||
const float | maxSpeed, | ||
const float | minRotationSpeed, | ||
const float | maxRotationSpeed | ||
) |
Set velocity range This functions sets minimum and maximum rotation values for determining the initial trajectory of the particles. The values are randomly selected (according to a uniform distribution) between the min and max values. If the values are the same, then the particle direction will not behave randomly.
minDirection | Maximum initial angle of trajectory |
maxDirection | Minimum initial angle of trajectory |
minSpeed | Minimum initial speed |
maxSpeed | Maximum initial speed |
minRotationSpeed | Minimum initial rotation speed |
maxRotationSpeed | Maximum initial rotation speed |
Definition at line 63 of file imstkRenderParticleEmitter.cpp.