CUGL 3.0
Cornell University Game Library
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
cugl::graphics::ParticleEmitter Class Reference

#include <CUParticleSystem.h>

Public Member Functions

 ParticleEmitter ()
 
 ParticleEmitter (Uint64 seed)
 
 ParticleEmitter (const std::shared_ptr< JsonValue > &data)
 

Public Attributes

std::shared_ptr< Randomgenerator
 
Vec3 position
 
Vec3 velocity
 
float lifespan
 
double interval
 
double duration
 
double remainder
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ParticleEmitter() [1/3]

cugl::graphics::ParticleEmitter::ParticleEmitter ( )
inline

Creates a degenerate particle emitter

No particles will be emitted until the velocity, lifespan, and time interval are set.

◆ ParticleEmitter() [2/3]

cugl::graphics::ParticleEmitter::ParticleEmitter ( Uint64  seed)
inline

Creates a particle emitter with the given random generator seed.

All other attributes will be zeroed out.

Parameters
seedThe random generator seed.

◆ ParticleEmitter() [3/3]

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.

Parameters
dataThe JSON object specifying the emitter

Member Data Documentation

◆ duration

double cugl::graphics::ParticleEmitter::duration

The amount of time (in seconds) that has passed for this emitter

◆ generator

std::shared_ptr<Random> cugl::graphics::ParticleEmitter::generator

The random number generator for this emitter

◆ interval

double cugl::graphics::ParticleEmitter::interval

The amount of time (in seconds) between emissions

◆ lifespan

float cugl::graphics::ParticleEmitter::lifespan

The lifespan of emitted particles

◆ position

Vec3 cugl::graphics::ParticleEmitter::position

The location of this emitter

◆ remainder

double cugl::graphics::ParticleEmitter::remainder

The amount of time remaining until the next emission

◆ velocity

Vec3 cugl::graphics::ParticleEmitter::velocity

The initial velocity of particles emitted


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