www.pudn.com > 32709.zip > particle.h
/*************************************************** * Developer: Clinton Jon Selke * * Version: Totally FreeWare (Do what you will) * * Section: Particle Interface * ***************************************************/ #ifndef _PARTICLE_H_ #define _PARTICLE_H_ #include#include #include "vector3.h" struct Particle; // A single particle for the particle system class ParticleSystem { public: ParticleSystem( const Vector3& position, // Particle System's Position const Vector3& velocity, // Particle System's Velocity float min_dying_age, // Minimum particle dying age float max_dying_age, // Maximum particle dying age float start_size, // Starting size of particle float end_size, // Finishing size of particle float start_alpha, // Starting transparency of particle float end_alpha, // Finishing transparency of particle float min_speed, // Minimum particle starting speed float max_speed, // Maximum particle starting speed float create_delay, // The time lapsed until the next particle is created const Vector3& start_colour,// Starting colour of particle const Vector3& end_colour, // Finishing colour of particle const Vector3& gravity, // Gravity vector unsigned int max_particles);// Maximum number of particles ~ParticleSystem(); // Frees up resources static void loadTexture(); // Loads in OpenGL Texture void calculate(float dt); // Calculates next display void draw(); // Draws all particles using OpenGL private: // Particle constants const float MIN_DYING_AGE, MAX_DYING_AGE, START_SIZE, END_SIZE, START_ALPHA, END_ALPHA, MIN_SPEED, MAX_SPEED, CREATE_DELAY; const Vector3 START_COLOUR, END_COLOUR, GRAVITY; const unsigned int MAX_PARTICLES; // Particle storage unsigned int _number_of_particles; // The number of particles Particle **_particle_array; // An array of pointers to particles // Particle Systems Stats Vector3 _position; // Particle systems position Vector3 _velocity; // Particle systems velocity float _creation_timer; // Time until particle is created // Particle Texture static GLuint _particle_texture; // stores particle OpenGL texture }; #endif /*_PARTICLE_H_*/