Brenta Engine 1.1
Loading...
Searching...
No Matches
brenta::particle_emitter Class Reference

ParticleEmitter class. More...

#include <particles.hpp>

Data Structures

class  builder
 Builder pattern for ParticleEmitter. More...
 

Public Member Functions

 particle_emitter ()
 Empty constructor.
 
 particle_emitter (glm::vec3 starting_position, glm::vec3 starting_velocity, glm::vec3 starting_spread, float starting_timeToLive, int num_particles, float spawn_rate, float scale, std::string atlas_path, int atlas_width, int atlas_height, int atlas_index, camera *cam)
 Construct a new ParticleEmitter object.
 
 ~particle_emitter ()
 Destroy the ParticleEmitter object.
 
void update_particles (float deltaTime)
 Update the particles.
 
void render_particles ()
 Render the particles.
 

Data Fields

glm::vec3 starting_position
 Starting position of a new particle.
 
glm::vec3 starting_velocity
 Starting velocity of a new particle.
 
glm::vec3 starting_spread
 Starting spread of a new particle.
 
float starting_time_to_live
 Time to live of a new particle.
 
int num_particles
 Number of particles.
 
float spawn_rate
 Spawn rate of particles.
 
float scale
 Scale of particles.
 
types::buffer fbo [2]
 Feddback buffer objects.
 
int current
 Current fbo index.
 
int atlas
 Atlas texture.
 
int atlas_width
 Atlas width.
 
int atlas_height
 Atlas height.
 
int atlas_index
 Atlas index.
 
types::vao vao
 Vertex array object.
 

Detailed Description

ParticleEmitter class.

This class is used to define a particle emitter, update and render its particles. This class provides a builder pattern to create a ParticleEmitter object. The particles ban be updated and rendered using the updateParticles and renderParticles methods.

Definition at line 53 of file particles.hpp.

Constructor & Destructor Documentation

◆ particle_emitter() [1/2]

particle_emitter::particle_emitter ( )

Empty constructor.

Sets default values

Definition at line 40 of file particles.cpp.

◆ particle_emitter() [2/2]

particle_emitter::particle_emitter ( glm::vec3 starting_position,
glm::vec3 starting_velocity,
glm::vec3 starting_spread,
float starting_timeToLive,
int num_particles,
float spawn_rate,
float scale,
std::string atlas_path,
int atlas_width,
int atlas_height,
int atlas_index,
camera * cam )

Construct a new ParticleEmitter object.

Parameters
starting_positionStarting position of a new particle
starting_velocityStarting velocity of a new particle
starting_spreadStarting spread of a new particle
starting_timeToLiveTime to live of a new particle
num_particlesNumber of particles
spawn_rateSpawn rate of particles
scaleScale of particles
atlas_pathAtlas texture path
atlas_widthAtlas width
atlas_heightAtlas height
atlas_indexAtlas index
cameraCamera

Definition at line 57 of file particles.cpp.

◆ ~particle_emitter()

particle_emitter::~particle_emitter ( )

Destroy the ParticleEmitter object.

Definition at line 125 of file particles.cpp.

Member Function Documentation

◆ render_particles()

void particle_emitter::render_particles ( )

Render the particles.

Definition at line 183 of file particles.cpp.

◆ update_particles()

void particle_emitter::update_particles ( float deltaTime)

Update the particles.

Parameters
deltaTimeTime passed since last frame

Definition at line 134 of file particles.cpp.

Field Documentation

◆ atlas

int brenta::particle_emitter::atlas

Atlas texture.

Definition at line 98 of file particles.hpp.

◆ atlas_height

int brenta::particle_emitter::atlas_height

Atlas height.

Definition at line 106 of file particles.hpp.

◆ atlas_index

int brenta::particle_emitter::atlas_index

Atlas index.

Definition at line 110 of file particles.hpp.

◆ atlas_width

int brenta::particle_emitter::atlas_width

Atlas width.

Definition at line 102 of file particles.hpp.

◆ current

int brenta::particle_emitter::current

Current fbo index.

Definition at line 94 of file particles.hpp.

◆ fbo

types::buffer brenta::particle_emitter::fbo[2]

Feddback buffer objects.

These are used to save the new state of updated particles in the updateParticles method.

Definition at line 90 of file particles.hpp.

◆ num_particles

int brenta::particle_emitter::num_particles

Number of particles.

Definition at line 75 of file particles.hpp.

◆ scale

float brenta::particle_emitter::scale

Scale of particles.

Definition at line 83 of file particles.hpp.

◆ spawn_rate

float brenta::particle_emitter::spawn_rate

Spawn rate of particles.

Definition at line 79 of file particles.hpp.

◆ starting_position

glm::vec3 brenta::particle_emitter::starting_position

Starting position of a new particle.

Definition at line 59 of file particles.hpp.

◆ starting_spread

glm::vec3 brenta::particle_emitter::starting_spread

Starting spread of a new particle.

Definition at line 67 of file particles.hpp.

◆ starting_time_to_live

float brenta::particle_emitter::starting_time_to_live

Time to live of a new particle.

Definition at line 71 of file particles.hpp.

◆ starting_velocity

glm::vec3 brenta::particle_emitter::starting_velocity

Starting velocity of a new particle.

Definition at line 63 of file particles.hpp.

◆ vao

types::vao brenta::particle_emitter::vao

Vertex array object.

Definition at line 114 of file particles.hpp.


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