sgltk 0.6
Simple OpenGL Tool Kit
|
The implementation of a particle system using the mesh class. More...
#include <particle.h>
Public Member Functions | |
void | resize (unsigned int number) |
Sets the number of the particles in the system. | |
void | setup_shader (sgltk::Shader *shader) |
Specifies the shader to use to render the particles. | |
void | setup_camera (sgltk::Camera *camera) |
Sets up the view and projection matrices that will be used to render the particles. | |
void | setup_camera (glm::mat4 *view_matrix, glm::mat4 *projection_matrix) |
Sets up the view and projection matrices that will be used to render the particles. | |
void | attach_texture (const std::string &name, const sgltk::Texture &texture) |
Attaches a texture to the particles. | |
bool | add_particle (glm::vec3 position, glm::vec3 velocity, float lifetime) |
Adds a new particle to the system if the particle buffer has an empty space. | |
bool | add_particle_immediately (glm::vec3 position, glm::vec3 velocity, float lifetime) |
Adds a new particle to the system if the particle buffer has an empty space and immediately updates the buffer. | |
void | update_all () |
Updates the particle buffers. | |
void | draw () |
Draws the particles. |
The implementation of a particle system using the mesh class.
Definition at line 16 of file particle.h.
Particles::Particles | ( | ) |
Definition at line 5 of file particle.cpp.
Particles::~Particles | ( | ) |
Definition at line 9 of file particle.cpp.
bool Particles::add_particle | ( | glm::vec3 | position, |
glm::vec3 | velocity, | ||
float | lifetime ) |
Adds a new particle to the system if the particle buffer has an empty space.
position | The position of the new particle |
velocity | The velocity vector of the new particle |
lifetime | The lifetime of the particle in seconds |
Definition at line 50 of file particle.cpp.
bool Particles::add_particle_immediately | ( | glm::vec3 | position, |
glm::vec3 | velocity, | ||
float | lifetime ) |
Adds a new particle to the system if the particle buffer has an empty space and immediately updates the buffer.
position | The position of the new particle |
velocity | The velocity vector of the new particle |
lifetime | The lifetime of the particle in seconds |
Definition at line 66 of file particle.cpp.
void Particles::attach_texture | ( | const std::string & | name, |
const sgltk::Texture & | texture ) |
Attaches a texture to the particles.
Definition at line 44 of file particle.cpp.
void Particles::draw | ( | ) |
Draws the particles.
Definition at line 97 of file particle.cpp.
void Particles::resize | ( | unsigned int | number | ) |
Sets the number of the particles in the system.
number | The new number of particles |
Definition at line 12 of file particle.cpp.
void Particles::setup_camera | ( | glm::mat4 * | view_matrix, |
glm::mat4 * | projection_matrix ) |
Sets up the view and projection matrices that will be used to render the particles.
view_matrix | The view matrix |
projection_matrix | The projection matrix |
Definition at line 38 of file particle.cpp.
void Particles::setup_camera | ( | sgltk::Camera * | camera | ) |
Sets up the view and projection matrices that will be used to render the particles.
camera | The camera to be used to draw the particles |
Definition at line 34 of file particle.cpp.
void Particles::setup_shader | ( | sgltk::Shader * | shader | ) |
Specifies the shader to use to render the particles.
shader | The shader to be used to render the particles |
Definition at line 30 of file particle.cpp.
void Particles::update_all | ( | ) |
Updates the particle buffers.
Definition at line 88 of file particle.cpp.