This class represents a single particle.
More...
#include <Particle.h>
List of all members.
Public Member Functions |
| Particle (const vl::vec3 &pos, const vl::vec3 &dir, int w, int h, int d) |
| ~Particle (void) |
void | prepareUpdate (vl::ref< vl::Image > image, vl::ref< vl::Image > gradient, vl::ref< vl::Image > curvature, ParticleMap &map, const std::vector< vl::vec3 > &candidatePositions, std::vector< bool > &spawnMap, float kC, float kF, float flockSigma, float kD, const vl::vec3 &userDir, float kR, float sigmaRepulse, bool enableDying, float crowdedThreshold, float crowdedSigma, int dyingNeighborhood, float density, bool stick) |
void | updateMap (ParticleMap &map, float dt) |
void | addToMap (ParticleMap &map) |
void | update (float dt) |
vl::vec3 | getDirection () const |
vl::vec3 | getPosition () const |
vl::vec3 | getWorldPosition () const |
Private Member Functions |
bool | outOfBounds (const vl::vec3 &dir) const |
Private Attributes |
vl::vec3 | _position |
| Stores the position of the particle.
|
vl::vec3 | _direction |
| Stores the direction of the particle.
|
vl::vec3 | _nextDirection |
| Stores the next direction of the particle. This is set by prepareUpdate.
|
int | _width |
| Stores the width of the volume.
|
int | _height |
| Stores the height of the volume.
|
int | _depth |
| Stores the depth of the volume.
|
vl::vec3 | _nextPosition |
| Stores the next position of the particle.
|
bool | _wasDeath |
| Flag which indicates if the particle has died.
|
Detailed Description
This class represents a single particle.
Constructor & Destructor Documentation
Particle::Particle |
( |
const vl::vec3 & |
pos, |
|
|
const vl::vec3 & |
dir, |
|
|
int |
w, |
|
|
int |
h, |
|
|
int |
d |
|
) |
| |
Initializes the particle.
- Parameters:
-
pos | is the position of the particle in volume coordinates |
dir | is the initial direction of the particle |
w | is the width of the volume |
h | is the height of the volume |
d | is the depth of the volume |
Particle::~Particle |
( |
void |
| ) |
|
Member Function Documentation
Adds the particle to the particle map (initialization step).
vl::vec3 Particle::getDirection |
( |
| ) |
const |
|
inline |
Returns the direction of the particle.
vl::vec3 Particle::getPosition |
( |
| ) |
const |
|
inline |
Returns the model position of the particle.
vl::vec3 Particle::getWorldPosition |
( |
| ) |
const |
Returns the world position of the particle. It transforms the volume coordinates to the range [-10,10].
bool Particle::outOfBounds |
( |
const vl::vec3 & |
dir | ) |
const |
|
private |
void Particle::prepareUpdate |
( |
vl::ref< vl::Image > |
image, |
|
|
vl::ref< vl::Image > |
gradient, |
|
|
vl::ref< vl::Image > |
curvature, |
|
|
ParticleMap & |
map, |
|
|
const std::vector< vl::vec3 > & |
candidatePositions, |
|
|
std::vector< bool > & |
spawnMap, |
|
|
float |
kC, |
|
|
float |
kF, |
|
|
float |
flockSigma, |
|
|
float |
kD, |
|
|
const vl::vec3 & |
userDir, |
|
|
float |
kR, |
|
|
float |
sigmaRepulse, |
|
|
bool |
enableDying, |
|
|
float |
crowdedThreshold, |
|
|
float |
crowdedSigma, |
|
|
int |
dyingNeighborhood, |
|
|
float |
density, |
|
|
bool |
stick |
|
) |
| |
This method essentially does the bulk work and sets the _nextDirection according to the particle system's rules.
- Parameters:
-
image | is the volume |
gradient | is the gradient map |
candidatePositions | are the candidate positions where particles might spawn on the map |
curvature | is the curvature map |
map | is a map of all particles |
spawnMap | is a boolean map indicating where dead particles are spawning. This is to prevent collisions on spawning particles. |
kC | is the influence of the curvature |
kF | is the influence of the flocking |
flockSigma | is essentially the neighborhood-size which should be used for flocking |
kD | is the influence of the preferred user direction |
userDir | is the user preferred direction |
kR | is the influence of the repulsion |
sigmaRepulse | is the size of the neighborhood used for repulsion |
enableDying | is a flag, which indicates whether particles should die |
crowdedSigma | influences the neighbourhood which should be checked if a particle dies |
crowdedThreshold | is a threshold above which a particle dies |
dyingNeighborhood | |
density | is the initialization particle density |
stick | indicates if particles should stick to the surface. |
void Particle::update |
( |
float |
dt | ) |
|
Updates the actual position of the particle on the particle map.
void Particle::updateMap |
( |
ParticleMap & |
map, |
|
|
float |
dt |
|
) |
| |
Updates the position of the particle on the particle map and removes the old position from the map.
Member Data Documentation
Stores the depth of the volume.
vl::vec3 Particle::_direction |
|
private |
Stores the direction of the particle.
Stores the height of the volume.
vl::vec3 Particle::_nextDirection |
|
private |
Stores the next direction of the particle. This is set by prepareUpdate.
vl::vec3 Particle::_nextPosition |
|
private |
Stores the next position of the particle.
vl::vec3 Particle::_position |
|
private |
Stores the position of the particle.
Flag which indicates if the particle has died.
Stores the width of the volume.
The documentation for this class was generated from the following files: