Brenta Engine 1.0
Loading...
Searching...
No Matches
Brenta::ParticleEmitter Class Reference

ParticleEmitter class. More...

#include <particles.hpp>

Data Structures

class  Builder
 Builder pattern for ParticleEmitter. More...
 

Public Member Functions

 ParticleEmitter ()
 Empty constructor.
 
 ParticleEmitter (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 *camera)
 Construct a new ParticleEmitter object.
 
 ~ParticleEmitter ()
 Destroy the ParticleEmitter object.
 
void updateParticles (float deltaTime)
 Update the particles.
 
void renderParticles ()
 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_timeToLive
 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

◆ ParticleEmitter() [1/2]

ParticleEmitter::ParticleEmitter ( )

Empty constructor.

Sets default values

Definition at line 40 of file particles.cpp.

◆ ParticleEmitter() [2/2]

ParticleEmitter::ParticleEmitter ( 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 * camera )

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.

◆ ~ParticleEmitter()

ParticleEmitter::~ParticleEmitter ( )

Destroy the ParticleEmitter object.

Definition at line 123 of file particles.cpp.

Member Function Documentation

◆ renderParticles()

void ParticleEmitter::renderParticles ( )

Render the particles.

Definition at line 181 of file particles.cpp.

◆ updateParticles()

void ParticleEmitter::updateParticles ( float deltaTime)

Update the particles.

Parameters
deltaTimeTime passed since last frame

Definition at line 132 of file particles.cpp.

Field Documentation

◆ atlas

int Brenta::ParticleEmitter::atlas

Atlas texture.

Definition at line 98 of file particles.hpp.

◆ atlas_height

int Brenta::ParticleEmitter::atlas_height

Atlas height.

Definition at line 106 of file particles.hpp.

◆ atlas_index

int Brenta::ParticleEmitter::atlas_index

Atlas index.

Definition at line 110 of file particles.hpp.

◆ atlas_width

int Brenta::ParticleEmitter::atlas_width

Atlas width.

Definition at line 102 of file particles.hpp.

◆ current

int Brenta::ParticleEmitter::current

Current fbo index.

Definition at line 94 of file particles.hpp.

◆ fbo

Types::Buffer Brenta::ParticleEmitter::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::ParticleEmitter::num_particles

Number of particles.

Definition at line 75 of file particles.hpp.

◆ scale

float Brenta::ParticleEmitter::scale

Scale of particles.

Definition at line 83 of file particles.hpp.

◆ spawn_rate

float Brenta::ParticleEmitter::spawn_rate

Spawn rate of particles.

Definition at line 79 of file particles.hpp.

◆ starting_position

glm::vec3 Brenta::ParticleEmitter::starting_position

Starting position of a new particle.

Definition at line 59 of file particles.hpp.

◆ starting_spread

glm::vec3 Brenta::ParticleEmitter::starting_spread

Starting spread of a new particle.

Definition at line 67 of file particles.hpp.

◆ starting_timeToLive

float Brenta::ParticleEmitter::starting_timeToLive

Time to live of a new particle.

Definition at line 71 of file particles.hpp.

◆ starting_velocity

glm::vec3 Brenta::ParticleEmitter::starting_velocity

Starting velocity of a new particle.

Definition at line 63 of file particles.hpp.

◆ vao

Types::VAO Brenta::ParticleEmitter::vao

Vertex array object.

Definition at line 114 of file particles.hpp.


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