Brian Paul | 5b0a7f3 | 2000-06-27 16:52:38 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This program is under the GNU GPL. |
| 3 | * Use at your own risk. |
| 4 | * |
| 5 | * written by David Bucciarelli (humanware@plus.it) |
| 6 | * Humanware s.r.l. |
| 7 | */ |
| 8 | |
| 9 | #ifndef PARTICLES_H |
| 10 | #define PARTICLES_H |
| 11 | |
| 12 | #include <GL/gl.h> |
| 13 | |
| 14 | class particle { |
| 15 | protected: |
| 16 | float age; // in seconds |
| 17 | float acc[3]; |
| 18 | float vel[3]; |
| 19 | float pos[3]; |
| 20 | |
| 21 | public: |
| 22 | particle(); |
| 23 | virtual ~particle() {}; |
| 24 | |
| 25 | virtual void beginDraw(void) {}; |
| 26 | virtual void draw(void)=0; |
| 27 | virtual void endDraw(void) {}; |
| 28 | |
| 29 | virtual void elapsedTime(float); |
| 30 | virtual void checkAge(void) {}; |
| 31 | }; |
| 32 | |
| 33 | class particleSystem { |
| 34 | protected: |
| 35 | particle **part; |
| 36 | |
| 37 | float t; |
| 38 | |
| 39 | unsigned long particleNum; |
| 40 | public: |
| 41 | particleSystem(); |
| 42 | ~particleSystem(); |
| 43 | |
| 44 | void addParticle(particle *); |
| 45 | |
| 46 | void reset(void); |
| 47 | |
| 48 | void draw(void); |
| 49 | |
| 50 | void addTime(float); |
| 51 | }; |
| 52 | |
| 53 | class rainParticle : public particle { |
| 54 | protected: |
| 55 | static float min[3]; |
| 56 | static float max[3]; |
| 57 | static float partLength; |
| 58 | |
| 59 | float oldpos[3]; |
| 60 | |
| 61 | void init(void); |
| 62 | public: |
| 63 | rainParticle(); |
| 64 | |
| 65 | static void setRainingArea(float, float, float, |
| 66 | float, float, float); |
| 67 | static void setLength(float); |
| 68 | static float getLength(void) { return partLength; }; |
| 69 | |
| 70 | void beginDraw(void) { glBegin(GL_LINES); }; |
| 71 | void draw(void); |
| 72 | void endDraw(void) { glEnd(); }; |
| 73 | |
| 74 | void elapsedTime(float); |
| 75 | |
| 76 | void checkAge(void); |
| 77 | |
| 78 | void randomHeight(void); |
| 79 | }; |
| 80 | |
| 81 | #endif |