#ifndef _particle_hh_ #define _particle_hh_ #include "time.hh" #include #include #include "misc.hh" #include "landscape.hh" class Particle { protected: float size; float x, y, z; float speedX, speedY, speedZ; float timeLeft; float timeDec; float color[3]; float colorDec[3]; public: static GLuint tex; static GLuint cList; static void buildList(); virtual void draw(); Particle( GLfloat _size, GLfloat _x, GLfloat _y, GLfloat _z, GLfloat _colorR, GLfloat _colorG, GLfloat _colorB, GLfloat _colorRend, GLfloat _colorGend, GLfloat _colorBend, GLfloat _speedX, GLfloat _speedY, GLfloat _speedZ, GLfloat _timeDec ); virtual ~Particle(); bool alive(); void move(); }; /* Functor for destoring particles as they die */ class ParticleEraser { public: bool operator() ( Particle * p ) { p->move(); if ( !p->alive() ) { //particles thinks it has done it's work clean up delete p; return true; } return false; } }; #endif /* _particle_hh_ */