Confetti
0.1.0
A C++ particle system using Vulkan
|
A particle base class. More...
#include <Confetti/Particle.h>
Public Member Functions | |
Particle ()=default | |
Constructor. | |
Particle (float lifetime, float age, glm::vec3 const &position, glm::vec3 const &velocity, glm::vec4 const &color) | |
Constructor. More... | |
virtual | ~Particle ()=default |
Destructor. | |
virtual bool | update (float dt) |
Updates the particle. Returns true if the particle was reborn. More... | |
virtual void | draw (std::shared_ptr< Vkx::Device > device) const =0 |
Draws the particle. More... | |
void | bind (BasicEmitter *pEmitter) |
Binds to an emitter. | |
float | age () const |
Returns the age of the particle. | |
glm::vec3 | position () const |
Returns the particle's current position. | |
glm::vec3 | velocity () const |
Returns the particle's current velocity. | |
glm::vec4 | color () const |
Returns the particle's current velocity. | |
Protected Member Functions | |
void | initialize (float lifetime, float age, glm::vec3 const &position, glm::vec3 const &velocity, glm::vec4 const &color) |
Initializes after using the default constructor. More... | |
Protected Attributes | |
BasicEmitter const * | emitter_ |
This particle's emitter. | |
float | lifetime_ |
Max age. | |
float | age_ |
Current age. | |
glm::vec3 | initialPosition_ |
Position at birth relative to emitter. | |
glm::vec3 | initialVelocity_ |
Velocity at birth relative to emitter. | |
glm::vec3 | position_ |
Current position. | |
glm::vec3 | velocity_ |
Current velocity. | |
glm::vec4 | initialColor_ |
Color at birth. | |
glm::vec4 | color_ |
Current color. | |
A particle base class.
A Particle is a point with a lifetime, age, position, and velocity. It has no size, shape, orientation, color, or texture.
Confetti::Particle::Particle | ( | float | lifetime, |
float | age, | ||
glm::vec3 const & | position, | ||
glm::vec3 const & | velocity, | ||
glm::vec4 const & | color | ||
) |
Constructor.
lifetime | How long the particle lives. |
age | Initial age. |
position | Position at birth. |
velocity | Velocity at birth. |
|
pure virtual |
Draws the particle.
Implemented in Confetti::TexturedParticle, Confetti::PointParticle, Confetti::SphereParticle, and Confetti::StreakParticle.
|
protected |
Initializes after using the default constructor.
lifetime | How long the particle lives. |
age | Initial age. |
position | Position at birth. |
velocity | Velocity at birth. |
color | Color at birth |
|
virtual |
Updates the particle. Returns true if the particle was reborn.
dt | The amount of time that has passed since the last update. |
Reimplemented in Confetti::TexturedParticle, Confetti::PointParticle, Confetti::SphereParticle, and Confetti::StreakParticle.