1 | /*! |
---|
2 | \file particle_system.h |
---|
3 | |
---|
4 | */ |
---|
5 | |
---|
6 | #ifndef _PARTICLE_SYSTEM_H |
---|
7 | #define _PARTICLE_SYSTEM_H |
---|
8 | |
---|
9 | #include "base_object.h" |
---|
10 | #include "vector.h" |
---|
11 | |
---|
12 | //! An enumerator for the different types of particles. |
---|
13 | typedef enum PARTICLE_TYPE {PARTICLE_DOT, |
---|
14 | PARTICLE_SPRITE, |
---|
15 | PARTICLE_OBJECT, |
---|
16 | PARTICLE_OBJECT_ARRAY, |
---|
17 | PARTICLE_PRIMITIVE}; |
---|
18 | |
---|
19 | #define PARTICLE_DEFAULT_COUNT 200 //!< a default count of particles in the system. |
---|
20 | #define PARTICLE_DEFAULT_TYPE PARTICLE_SPRITE //!< A default type of the system. |
---|
21 | |
---|
22 | // FORWARD DEFINITION |
---|
23 | class Material; |
---|
24 | class ParticleEmitter; |
---|
25 | |
---|
26 | |
---|
27 | //! A struct for one Particle |
---|
28 | typedef struct Particle |
---|
29 | { |
---|
30 | float timeToLive; //!< The time this particle lives from NOW on. |
---|
31 | Vector position; //!< The current position of this particle. |
---|
32 | Vector velocity; //!< The current velocity of this particle. |
---|
33 | Quaternion rotation; //!< The current rotation of this particle. |
---|
34 | |
---|
35 | // Particle* next; //!< pointer to the next particle in the List. (NULL if no preceding one) |
---|
36 | }; |
---|
37 | |
---|
38 | //! A class to handle particle Systems |
---|
39 | class ParticleSystem : public BaseObject { |
---|
40 | |
---|
41 | public: |
---|
42 | ParticleSystem(unsigned int particleCount = PARTICLE_DEFAULT_COUNT, PARTICLE_TYPE type = PARTICLE_DEFAULT_TYPE); |
---|
43 | virtual ~ParticleSystem(); |
---|
44 | |
---|
45 | void setMaterial(Material* material); |
---|
46 | void addEmitter(ParticleEmitter* emitter); |
---|
47 | |
---|
48 | private: |
---|
49 | int particleCount; //!< the count of Particles for this ParticleSystem. |
---|
50 | PARTICLE_TYPE particleType;//!< A type for the Particles |
---|
51 | Particle* particles; //!< A list of particles of this System. |
---|
52 | Material* material; //!< A Material for all the Particles. |
---|
53 | |
---|
54 | ParticleEmitter* emitter; //!< An emitter for this particleSystem. |
---|
55 | }; |
---|
56 | |
---|
57 | #endif /* _PARTICLE_SYSTEM_H */ |
---|