Main Page | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals

/Users/blackie/Documents/myRepository/phobosengine-vc2005/phobosengine/phobosengine/ParticleSystem.h

Go to the documentation of this file.
00001 
00002 
00003 #ifndef PARTICLESYSTEM_H
00004 #define PARTICLESYSTEM_H
00005 
00006 
00007 
00008 #include "RenderableObject.h"
00009 #include "Vector3f.h"
00010 
00011 #include <string>
00012 
00013 
00014 namespace pge {
00015 
00016 
00017         class Texture;
00018 
00019 
00020         class ParticleSystem : public IRenderableObject {
00021 
00022         public:
00023                 //************************************************************************
00024                 //
00025                 // Data structures
00026                 //
00027                 //************************************************************************
00028                 struct Particle {
00029                         Vector3f m_position;
00030                         Vector3f m_direction;
00031                         float m_life;
00032                 };
00033 
00034                 enum ParticleLoopMode {
00035                         ParticleLoopForever,
00036                         ParticlePlayOnce
00037                 };
00038 
00039 
00040                 //************************************************************************
00041                 //
00042                 // Constructor
00043                 //
00044                 //************************************************************************
00046                 ParticleSystem(const std::string &textureFile, Vector3f startPoint, Vector3f direction, int particleNum);
00047 
00048 
00049                 //************************************************************************
00050                 //
00051                 // Destructor
00052                 //
00053                 //************************************************************************
00055                 virtual ~ParticleSystem(void);
00056 
00057 
00058                 //************************************************************************
00059                 //
00060                 // Functions
00061                 //
00062                 //************************************************************************
00063                 bool init(void);                
00064                 void render(void);
00065                 void timer(unsigned int delay);
00066 
00068                 void setDirection(Vector3f direction);
00069 
00070 
00072                 void setStartPoint(Vector3f start);
00073 
00074 
00076                 void setGravity(Vector3f gravity);
00077 
00078                 void setFadeOutStart(Vector3f start);
00079                 void setFadeOutEnd(Vector3f end);
00080                 void setFadeOutEnabled(bool enabled);
00081                 void setLifeDegeneration(float lifeDeg);
00082 
00084 
00091                 void setLoopMode(ParticleLoopMode mode);
00092 
00093 
00095                 void setTexture(Texture *texture);
00096 
00097 
00099                 void setParticleNum(int num);
00100 
00101 
00103                 void setParticleSize(float size);
00104 
00105 
00107                 void setDistribution(int dist);
00108 
00109 
00111                 void setVelocity(float velocity);
00112 
00113 
00115 
00124                 void activate(void);
00125 
00126 
00128                 void deactivate(void);
00129 
00130 
00132                 void reset(void);
00133 
00134 
00135         private:
00136 
00137                 //************************************************************************
00138                 //
00139                 // Functions
00140                 //
00141                 //************************************************************************
00142                 void resetParticle(Particle *particle);
00143 
00144 
00145                 //************************************************************************
00146                 //
00147                 // Variables
00148                 //
00149                 //************************************************************************
00151                 Vector3f m_startPoint;
00152 
00154                 Vector3f m_startDirection;
00155 
00157                 Vector3f m_gravity;
00158 
00160                 int m_particleNum;
00161 
00163                 int m_distribution;
00164 
00166                 float m_size;
00167 
00169                 Particle *m_particleArray;
00170 
00172                 float m_velocity;
00173 
00175                 Texture *m_texture;
00176 
00178                 bool m_billboard;
00179 
00181                 bool m_usePointSpriteExt;
00182 
00184                 float m_maxSizeExt;
00185 
00187                 ParticleLoopMode m_loopMode;
00188 
00190                 bool m_active;
00191 
00192                 // Life degeneration.
00193                 float m_lifeDeg;
00194 
00195                 // / Blend out settings.
00196                 Vector3f m_startFade;
00197                 Vector3f m_endFade;
00198                 bool m_fadeEnabled;
00199         };
00200 };
00201 
00202 #endif

Generated on Mon Oct 16 12:08:10 2006 for Phobosengine by doxygen 1.3.4