![]() |
CUGL 3.0
Cornell University Game Library
|
#include <CUParticleSystem.h>
Public Member Functions | |
ParticleEmitter () | |
ParticleEmitter (Uint64 seed) | |
ParticleEmitter (const std::shared_ptr< JsonValue > &data) | |
Public Attributes | |
std::shared_ptr< Random > | generator |
Vec3 | position |
Vec3 | velocity |
float | lifespan |
double | interval |
double | duration |
double | remainder |
This class defines a single particle emitter.
A particle system is collection of one or more emitters. Emitters define the location, velocity, and time interval used to create particles. They also all have their own random number generator to keep behavior reproducible.
ParticleTemplates are internal to a ParticleSystem
, so we do not refer to them with shared pointers. We treat them like a math class that goes on the stack.
|
inline |
Creates a degenerate particle emitter
No particles will be emitted until the velocity, lifespan, and time interval are set.
|
inline |
Creates a particle emitter with the given random generator seed.
All other attributes will be zeroed out.
seed | The random generator seed. |
cugl::graphics::ParticleEmitter::ParticleEmitter | ( | const std::shared_ptr< JsonValue > & | data | ) |
Creates a particle emitter with the given JSON.
This initializer is designed to create a particle emitter during asset loading. This JSON format supports the following attribute values:
"random": A long an or array of longs defining the random seed "position": A float array of length 3 representing the position "velocity": A float array of length 3 representing emission velocity "lifespan": A float representing particle lifespan in seconds "internal": A float representing the emission interval in seconds
All of these values are optional. If "random" is missing, the clock will be used for the seed. All other attributes will be zeroed out.
data | The JSON object specifying the emitter |
double cugl::graphics::ParticleEmitter::duration |
The amount of time (in seconds) that has passed for this emitter
std::shared_ptr<Random> cugl::graphics::ParticleEmitter::generator |
The random number generator for this emitter
double cugl::graphics::ParticleEmitter::interval |
The amount of time (in seconds) between emissions
float cugl::graphics::ParticleEmitter::lifespan |
The lifespan of emitted particles
Vec3 cugl::graphics::ParticleEmitter::position |
The location of this emitter
double cugl::graphics::ParticleEmitter::remainder |
The amount of time remaining until the next emission
Vec3 cugl::graphics::ParticleEmitter::velocity |
The initial velocity of particles emitted