|
@@ -1,210 +1,124 @@
|
1
|
|
-/* -*- Mode: C++; tab-width: 3; indent-tabs-mode: t; c-basic-offset: 3 -*- */
|
2
|
|
-/*================================================================
|
|
1
|
+/*!
|
|
2
|
+ * \file Particle.h
|
|
3
|
+ * \brief Particle system base header
|
3
|
4
|
*
|
4
|
|
- * Project : Freyja
|
5
|
|
- * Author : Terry 'Mongoose' Hendrix II
|
6
|
|
- * Website : http://www.westga.edu/~stu7440/
|
7
|
|
- * Email : stu7440@westga.edu
|
8
|
|
- * Object : Particle
|
9
|
|
- * License : No use w/o permission (C)2001Mongoose
|
10
|
|
- * Comments: Partcle system's atomic base
|
11
|
|
- *
|
12
|
|
- *
|
13
|
|
- * This file was generated using Mongoose's C++
|
14
|
|
- * template generator script. <stu7440@westga.edu>
|
15
|
|
- *
|
16
|
|
- *-- History ------------------------------------------------
|
17
|
|
- *
|
18
|
|
- * 2001.08.13:
|
19
|
|
- * Mongoose - Created
|
20
|
|
- ================================================================*/
|
21
|
|
-
|
|
5
|
+ * \author Mongoose
|
|
6
|
+ */
|
22
|
7
|
|
23
|
8
|
#ifndef __FREYJA_MONGOOSE_PARTICLE_H_
|
24
|
9
|
#define __FREYJA_MONGOOSE_PARTICLE_H_
|
25
|
10
|
|
26
|
11
|
#include "hel/math.h"
|
27
|
12
|
|
28
|
|
-class Particle
|
29
|
|
-{
|
30
|
|
- public:
|
31
|
|
-
|
32
|
|
- Particle();
|
33
|
|
- /*------------------------------------------------------
|
34
|
|
- * Pre :
|
35
|
|
- * Post : Constructs an object of Particle
|
36
|
|
- *
|
37
|
|
- *-- History ------------------------------------------
|
38
|
|
- *
|
39
|
|
- * 2001.08.13:
|
40
|
|
- * Mongoose - Created
|
41
|
|
- ------------------------------------------------------*/
|
42
|
|
-
|
43
|
|
- ~Particle();
|
44
|
|
- /*------------------------------------------------------
|
45
|
|
- * Pre : Particle object is allocated
|
46
|
|
- * Post : Deconstructs an object of Particle
|
47
|
|
- *
|
48
|
|
- *-- History ------------------------------------------
|
49
|
|
- *
|
50
|
|
- * 2001.08.13:
|
51
|
|
- * Mongoose - Created
|
52
|
|
- ------------------------------------------------------*/
|
53
|
|
-
|
54
|
|
- void setActive(bool active);
|
55
|
|
- /*------------------------------------------------------
|
56
|
|
- * Pre :
|
57
|
|
- * Post : Toggles active state of particle
|
58
|
|
- *
|
59
|
|
- *-- History ------------------------------------------
|
60
|
|
- *
|
61
|
|
- * 2001.08.13:
|
62
|
|
- * Mongoose - Created
|
63
|
|
- ------------------------------------------------------*/
|
64
|
|
-
|
65
|
|
- void Force(float x, float y, float z);
|
66
|
|
- /*------------------------------------------------------
|
67
|
|
- * Pre :
|
68
|
|
- * Post : Sets gravity/force acting on particle
|
69
|
|
- *
|
70
|
|
- *-- History ------------------------------------------
|
71
|
|
- *
|
72
|
|
- * 2001.08.13:
|
73
|
|
- * Mongoose - Created
|
74
|
|
- ------------------------------------------------------*/
|
75
|
|
-
|
76
|
|
- void Reset();
|
77
|
|
- /*------------------------------------------------------
|
78
|
|
- * Pre :
|
79
|
|
- * Post : Resets particle to defaults
|
80
|
|
- *
|
81
|
|
- *-- History ------------------------------------------
|
82
|
|
- *
|
83
|
|
- * 2001.08.13:
|
84
|
|
- * Mongoose - Created
|
85
|
|
- ------------------------------------------------------*/
|
86
|
|
-
|
87
|
|
- void Speed(float x, float y, float z);
|
88
|
|
- /*------------------------------------------------------
|
89
|
|
- * Pre : note speed inits at 2000, lower is faster
|
90
|
|
- * Post : Sets particle speed
|
91
|
|
- *
|
92
|
|
- *-- History ------------------------------------------
|
93
|
|
- *
|
94
|
|
- * 2001.08.14:
|
95
|
|
- * Mongoose - Created
|
96
|
|
- ------------------------------------------------------*/
|
97
|
|
-
|
98
|
|
- void Color(float r, float g, float b);
|
99
|
|
- /*------------------------------------------------------
|
100
|
|
- * Pre : r,g,b are colors 0.0 to 1.0
|
101
|
|
- * Post : Sets new particle coloring
|
102
|
|
- *
|
103
|
|
- * NOTE : White {1.0, 1.0, 1.0} is the init color
|
104
|
|
- *
|
105
|
|
- *-- History ------------------------------------------
|
106
|
|
- *
|
107
|
|
- * 2001.08.14:
|
108
|
|
- * Mongoose - Created
|
109
|
|
- ------------------------------------------------------*/
|
110
|
|
-
|
111
|
|
- void Pos(float *x, float *y, float *z);
|
112
|
|
- /*------------------------------------------------------
|
113
|
|
- * Pre : x,y,z exist
|
114
|
|
- * Post : Returns position of particle in 3 space
|
115
|
|
- *
|
116
|
|
- *-- History ------------------------------------------
|
117
|
|
- *
|
118
|
|
- * 2001.08.13:
|
119
|
|
- * Mongoose - Created
|
120
|
|
- ------------------------------------------------------*/
|
121
|
|
-
|
122
|
|
- void Color(float *r, float *g, float *b);
|
123
|
|
- /*------------------------------------------------------
|
124
|
|
- * Pre : r,g,b exist
|
125
|
|
- * Post : Returns current color of particle
|
126
|
|
- *
|
127
|
|
- *-- History ------------------------------------------
|
128
|
|
- *
|
129
|
|
- * 2001.08.13:
|
130
|
|
- * Mongoose - Created
|
131
|
|
- ------------------------------------------------------*/
|
132
|
|
-
|
133
|
|
- float Life();
|
134
|
|
- /*------------------------------------------------------
|
135
|
|
- * Pre :
|
136
|
|
- * Post : Returns current life ( blend ) of particle
|
137
|
|
- *
|
138
|
|
- *-- History ------------------------------------------
|
139
|
|
- *
|
140
|
|
- * 2001.08.13:
|
141
|
|
- * Mongoose - Created
|
142
|
|
- ------------------------------------------------------*/
|
143
|
|
-
|
144
|
|
- void Update();
|
145
|
|
- /*------------------------------------------------------
|
146
|
|
- * Pre :
|
147
|
|
- * Post : Ajusts for particle life cycle
|
148
|
|
- *
|
149
|
|
- *-- History ------------------------------------------
|
150
|
|
- *
|
151
|
|
- * 2001.08.13:
|
152
|
|
- * Mongoose - Created
|
153
|
|
- ------------------------------------------------------*/
|
154
|
|
-
|
155
|
|
- int Texture();
|
156
|
|
- /*------------------------------------------------------
|
157
|
|
- * Pre :
|
158
|
|
- * Post : Returens texture binding for this particle
|
159
|
|
- *
|
160
|
|
- *-- History ------------------------------------------
|
161
|
|
- *
|
162
|
|
- * 2001.08.13:
|
163
|
|
- * Mongoose - Created
|
164
|
|
- ------------------------------------------------------*/
|
165
|
|
-
|
166
|
|
- bool isActive();
|
167
|
|
- /*------------------------------------------------------
|
168
|
|
- * Pre :
|
169
|
|
- * Post : Returns active value
|
170
|
|
- *
|
171
|
|
- *-- History ------------------------------------------
|
172
|
|
- *
|
173
|
|
- * 2001.08.13:
|
174
|
|
- * Mongoose - Created
|
175
|
|
- ------------------------------------------------------*/
|
176
|
|
-
|
177
|
|
- void TextureId(int t);
|
178
|
|
- /*------------------------------------------------------
|
179
|
|
- * Pre :
|
180
|
|
- * Post :
|
181
|
|
- *
|
182
|
|
- *-- History ------------------------------------------
|
183
|
|
- *
|
184
|
|
- * 2001.08.13:
|
185
|
|
- * Mongoose - Created
|
186
|
|
- ------------------------------------------------------*/
|
187
|
|
-
|
188
|
|
-
|
189
|
|
- private:
|
190
|
|
-
|
191
|
|
- bool _active; /* Is this particle in use? */
|
192
|
|
-
|
193
|
|
- float _life; /* Life of particle */
|
194
|
|
-
|
195
|
|
- float _blend; /* Blend amount or fade */
|
196
|
|
-
|
197
|
|
- int _texture; /* Texture polygon to use */
|
198
|
|
-
|
199
|
|
- vec3_t _pos; /* Current position in 3 space */
|
200
|
|
-
|
201
|
|
- vec3_t _color; /* Current color */
|
202
|
|
-
|
203
|
|
- vec3_t _dir; /* Current direction */
|
204
|
|
-
|
205
|
|
- vec3_t _force; /* Current force or 'gravity' */
|
206
|
|
-
|
207
|
|
- vec3_t _speed; /* Speed of particle movement */
|
|
13
|
+/*!
|
|
14
|
+ * \brief Partcle systems atomic base
|
|
15
|
+ */
|
|
16
|
+class Particle {
|
|
17
|
+public:
|
|
18
|
+
|
|
19
|
+ /*!
|
|
20
|
+ * \brief Constructs an object of Sound
|
|
21
|
+ */
|
|
22
|
+ Particle();
|
|
23
|
+
|
|
24
|
+ /*!
|
|
25
|
+ * \brief Deconstructs an object of Sound
|
|
26
|
+ */
|
|
27
|
+ ~Particle();
|
|
28
|
+
|
|
29
|
+ /*!
|
|
30
|
+ * \brief Toggles active state of particle
|
|
31
|
+ * \param active new state
|
|
32
|
+ */
|
|
33
|
+ void setActive(bool active);
|
|
34
|
+
|
|
35
|
+ /*!
|
|
36
|
+ * \brief Sets gravity/force acting on particle
|
|
37
|
+ * \param x X part of force vector
|
|
38
|
+ * \param y Y part
|
|
39
|
+ * \param z Z part
|
|
40
|
+ */
|
|
41
|
+ void Force(float x, float y, float z);
|
|
42
|
+
|
|
43
|
+ /*!
|
|
44
|
+ * \brief Resets particle to defaults
|
|
45
|
+ */
|
|
46
|
+ void Reset();
|
|
47
|
+
|
|
48
|
+ /*!
|
|
49
|
+ * \brief Sets gravity/force acting on particle
|
|
50
|
+ * \note speed inits at 2000, lower is faster
|
|
51
|
+ * \param x X part of speed vector
|
|
52
|
+ * \param y Y part
|
|
53
|
+ * \param z Z part
|
|
54
|
+ */
|
|
55
|
+ void Speed(float x, float y, float z);
|
|
56
|
+
|
|
57
|
+ /*!
|
|
58
|
+ * \brief Sets new particle coloring
|
|
59
|
+ * \note White {1.0, 1.0, 1.0} is the init color
|
|
60
|
+ * \param r Red part, from 0.0 to 1.0
|
|
61
|
+ * \param g Green part, from 0.0 to 1.0
|
|
62
|
+ * \param b Blue part, from 0.0 to 1.0
|
|
63
|
+ */
|
|
64
|
+ void Color(float r, float g, float b);
|
|
65
|
+
|
|
66
|
+ /*!
|
|
67
|
+ * \brief Returns position of particle in 3 space
|
|
68
|
+ * \param x not NULL!
|
|
69
|
+ * \param y not NULL!
|
|
70
|
+ * \param z not NULL!
|
|
71
|
+ */
|
|
72
|
+ void Pos(float *x, float *y, float *z);
|
|
73
|
+
|
|
74
|
+ /*!
|
|
75
|
+ * \brief Returns current color of particle
|
|
76
|
+ * \param r not NULL!
|
|
77
|
+ * \param g not NULL!
|
|
78
|
+ * \param b not NULL!
|
|
79
|
+ */
|
|
80
|
+ void Color(float *r, float *g, float *b);
|
|
81
|
+
|
|
82
|
+ /*!
|
|
83
|
+ * \brief Returns current life (blend) of particle
|
|
84
|
+ * \returns fade of particle
|
|
85
|
+ */
|
|
86
|
+ float Life();
|
|
87
|
+
|
|
88
|
+ /*!
|
|
89
|
+ * \brief Adjusts for particle life cycle
|
|
90
|
+ */
|
|
91
|
+ void Update();
|
|
92
|
+
|
|
93
|
+ /*!
|
|
94
|
+ * \brief Returns texture binding for this particle
|
|
95
|
+ * \returns texture id
|
|
96
|
+ */
|
|
97
|
+ int Texture();
|
|
98
|
+
|
|
99
|
+ /*!
|
|
100
|
+ * \brief Returns active value
|
|
101
|
+ * \returns state
|
|
102
|
+ */
|
|
103
|
+ bool isActive();
|
|
104
|
+
|
|
105
|
+ /*!
|
|
106
|
+ * \brief Set the texture for this particle
|
|
107
|
+ * \param t new texture id
|
|
108
|
+ */
|
|
109
|
+ void TextureId(int t);
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+private:
|
|
113
|
+ bool _active; //!< Is this particle in use?
|
|
114
|
+ float _life; //!< Life of particle
|
|
115
|
+ float _blend; //!< Blend amount or fade
|
|
116
|
+ int _texture; //!< Texture polygon to use
|
|
117
|
+ vec3_t _pos; //!< Current position in 3 space
|
|
118
|
+ vec3_t _color; //!< Current color
|
|
119
|
+ vec3_t _dir; //!< Current direction
|
|
120
|
+ vec3_t _force; //!< Current force or 'gravity'
|
|
121
|
+ vec3_t _speed; //!< Speed of particle movement
|
208
|
122
|
};
|
209
|
123
|
|
210
|
124
|
#endif
|