Debian Codegraph @

include/iparticlestage.h

raw
1 #pragma once
2
3 #include <string>
4 #include <memory>
5
6 template<typename Element> class BasicVector3;
7 typedef BasicVector3<double> Vector3;
8 template<typename Element> class BasicVector4;
9 typedef BasicVector4<double> Vector4;
10
11 namespace particles
12 {
13
14 /**
15 * greebo: A particle parameter represents a bounded member value
16 * of a particle stage (e.g. speed or size).
17 *
18 * Use the evaluate() method to retrieve a particular value.
19 *
20 * It is modeled after the idParticleParam class in the D3 SDK.
21 */
22 class IParticleParameter
23 {
24 public:
25 // Get the lower bound of this parameter
26 virtual float getFrom() const = 0;
27
28 // Get the upper bound of this parameter
29 virtual float getTo() const = 0;
30
31 // Set the lower bound of this parameter
32 virtual void setFrom(float value) = 0;
33
34 // Set the upper bound of this parameter
35 virtual void setTo(float value) = 0;
36
37 // Return a specific value. Fraction == 0 returns the lower bound value.
38 virtual float evaluate(float fraction) const = 0;
39
40 // Returns the integrated value at the point <fraction>.
41 virtual float integrate(float fraction) const = 0;
42
43 // Comparison operators - particle parameters are considered equal
44 // if both from and to are equal
45 virtual bool operator==(const IParticleParameter& other) const = 0;
46 virtual bool operator!=(const IParticleParameter& other) const = 0;
47 };
48
49 /**
50 * \brief
51 * Definition of a single particle stage.
52 *
53 * Each stage consists of a set of particles with the same properties (texture,
54 * acceleration etc).
55 *
56 * Most of the member descriptions are directly taken from the D3 SDK.
57 */
58 class IStageDef
59 {
60 public:
61 using Ptr = std::shared_ptr<IStageDef>;
62
63 // Particle orientation
64 enum OrientationType
65 {
66 ORIENTATION_VIEW,
67 ORIENTATION_AIMED, // angle and aspect are disregarded
68 ORIENTATION_X,
69 ORIENTATION_Y,
70 ORIENTATION_Z
71 };
72
73 // Particle distribution
74 enum DistributionType
75 {
76 DISTRIBUTION_RECT, // ( sizeX sizeY sizeZ )
77 DISTRIBUTION_CYLINDER, // ( sizeX sizeY sizeZ )
78 DISTRIBUTION_SPHERE // ( sizeX sizeY sizeZ ringFraction )
79 // a ringFraction of zero allows the entire sphere, 0.9 would only
80 // allow the outer 10% of the sphere
81 };
82
83 // Particle direction
84 enum DirectionType
85 {
86 DIRECTION_CONE, // parm0 is the solid cone angle
87 DIRECTION_OUTWARD // direction is relative to offset from origin, parm0 is an upward bias
88 };
89
90 enum CustomPathType
91 {
92 PATH_STANDARD,
93 PATH_HELIX, // ( sizeX sizeY sizeZ radialSpeed climbSpeed )
94 PATH_FLIES,
95 PATH_ORBIT,
96 PATH_DRIP
97 };
98
99 public:
100
101 /// Get the shader name.
102 virtual const std::string& getMaterialName() const = 0;
103
104 /// Set the shader name.
105 virtual void setMaterialName(const std::string& material) = 0;
106
107 /// Get the particle count.
108 virtual int getCount() const = 0;
109
110 /// Set the particle count.
111 virtual void setCount(int count) = 0;
112
113 /**
114 * Get the duration in seconds.
115 */
116 virtual float getDuration() const = 0;
117
118 /**
119 * Set the duration in seconds, updates cyclemsec.
120 */
121 virtual void setDuration(float duration) = 0;
122
123 /**
124 * Returns ( duration + deadTime ) in msec.
125 */
126 virtual int getCycleMsec() const = 0;
127
128 /**
129 * Get the cycles value.
130 */
131 virtual float getCycles() const = 0;
132
133 /**
134 * Set the cycles value.
135 */
136 virtual void setCycles(float cycles) = 0;
137
138 /**
139 * Get the bunching value [0..1]
140 */
141 virtual float getBunching() const = 0;
142
143 /**
144 * Set the bunching value [0..1]
145 */
146 virtual void setBunching(float value) = 0;
147
148 /**
149 * Get the time offset in seconds
150 */
151 virtual float getTimeOffset() const = 0;
152
153 /**
154 * Set the time offset in seconds
155 */
156 virtual void setTimeOffset(float value) = 0;
157
158 /**
159 * Get the dead time in seconds
160 */
161 virtual float getDeadTime() const = 0;
162
163 /**
164 * Set the dead time in seconds, updates cyclemsec.
165 */
166 virtual void setDeadTime(float value) = 0;
167
168 /**
169 * Get the particle render colour.
170 */
171 virtual const Vector4& getColour() const = 0;
172
173 /**
174 * Set the particle render colour.
175 */
176 virtual void setColour(const Vector4& colour) = 0;
177
178 /**
179 * Get the particle render colour.
180 */
181 virtual const Vector4& getFadeColour() const = 0;
182
183 /**
184 * Set the particle render colour.
185 */
186 virtual void setFadeColour(const Vector4& colour) = 0;
187
188 /**
189 * Get the fade in fraction [0..1]
190 */
191 virtual float getFadeInFraction() const = 0;
192
193 /**
194 * Set the fade in fraction [0..1]
195 */
196 virtual void setFadeInFraction(float fraction) = 0;
197
198 /**
199 * Get the fade out fraction [0..1]
200 */
201 virtual float getFadeOutFraction() const = 0;
202
203 /**
204 * Set the fade out fraction [0..1]
205 */
206 virtual void setFadeOutFraction(float fraction) = 0;
207
208 /**
209 * Get the fade index fraction [0..1]
210 */
211 virtual float getFadeIndexFraction() const = 0;
212
213 /**
214 * Set the fade index fraction [0..1]
215 */
216 virtual void setFadeIndexFraction(float fraction) = 0;
217
218 /**
219 * Get the animation frames.
220 */
221 virtual int getAnimationFrames() const = 0;
222
223 /**
224 * Set the animation frames.
225 */
226 virtual void setAnimationFrames(int animationFrames) = 0;
227
228 /**
229 * Get the animation rate.
230 */
231 virtual float getAnimationRate() const = 0;
232
233 /**
234 * Set the animation frames.
235 */
236 virtual void setAnimationRate(float animationRate) = 0;
237
238 /**
239 * Get the initial angle.
240 */
241 virtual float getInitialAngle() const = 0;
242
243 /**
244 * Set the initial angle.
245 */
246 virtual void setInitialAngle(float angle) = 0;
247
248 /**
249 * Get the bounds expansion value.
250 */
251 virtual float getBoundsExpansion() const = 0;
252
253 /**
254 * Set the bounds expansion value.
255 */
256 virtual void setBoundsExpansion(float value) = 0;
257
258 /**
259 * Get the random distribution flag.
260 */
261 virtual bool getRandomDistribution() const = 0;
262
263 /**
264 * Set the random distribution flag.
265 */
266 virtual void setRandomDistribution(bool value) = 0;
267
268 /**
269 * Get the "use entity colour" flag.
270 */
271 virtual bool getUseEntityColour() const = 0;
272
273 /**
274 * Set the "use entity colour" flag.
275 */
276 virtual void setUseEntityColour(bool value) = 0;
277
278 /**
279 * Get the gravity factor.
280 */
281 virtual float getGravity() const = 0;
282
283 /**
284 * Set the gravity factor.
285 */
286 virtual void setGravity(float value) = 0;
287
288 /**
289 * Get the "apply gravity in world space" flag.
290 */
291 virtual bool getWorldGravityFlag() const = 0;
292
293 /**
294 * Get the "apply gravity in world space" flag.
295 */
296 virtual void setWorldGravityFlag(bool value) = 0;
297
298 /**
299 * Get the offset vector.
300 */
301 virtual const Vector3& getOffset() const = 0;
302
303 /**
304 * Set the offset vector.
305 */
306 virtual void setOffset(const Vector3& value) = 0;
307
308 /**
309 * Get the orientation type.
310 */
311 virtual OrientationType getOrientationType() const = 0;
312
313 /**
314 * Set the orientation type.
315 */
316 virtual void setOrientationType(OrientationType value) = 0;
317
318 /**
319 * Get the orientation parameter with the given index [0..3]
320 */
321 virtual float getOrientationParm(int parmNum) const = 0;
322
323 /*
324 * Set the orientation parameter with the given index [0..3].
325 */
326 virtual void setOrientationParm(int parmNum, float value) = 0;
327
328 /**
329 * Get the distribution type.
330 */
331 virtual DistributionType getDistributionType() const = 0;
332
333 /**
334 * Set the distribution type.
335 */
336 virtual void setDistributionType(DistributionType value) = 0;
337
338 /**
339 * Get the distribution parameter with the given index [0..3]
340 */
341 virtual float getDistributionParm(int parmNum) const = 0;
342
343 /*
344 * Set the distribution parameter with the given index [0..3].
345 */
346 virtual void setDistributionParm(int parmNum, float value) = 0;
347
348 /**
349 * Get the direction type.
350 */
351 virtual DirectionType getDirectionType() const = 0;
352
353 /**
354 * Set the direction type.
355 */
356 virtual void setDirectionType(DirectionType value) = 0;
357
358 /**
359 * Get the direction parameter with the given index [0..3]
360 */
361 virtual float getDirectionParm(int parmNum) const = 0;
362
363 /*
364 * Set the direction parameter with the given index [0..3].
365 */
366 virtual void setDirectionParm(int parmNum, float value) = 0;
367
368 /**
369 * Get the custom path type.
370 */
371 virtual CustomPathType getCustomPathType() const = 0;
372
373 /**
374 * Set the custom path type.
375 */
376 virtual void setCustomPathType(CustomPathType value) = 0;
377
378 /**
379 * Get the custom path parameter with the given index [0..7]
380 */
381 virtual float getCustomPathParm(int parmNum) const = 0;
382
383 /*
384 * Set the custom path parameter with the given index [0..7].
385 */
386 virtual void setCustomPathParm(int parmNum, float value) = 0;
387
388 /**
389 * Get the particle size
390 */
391 virtual const IParticleParameter& getSize() const = 0;
392 virtual IParticleParameter& getSize() = 0;
393
394 /**
395 * Get the aspect ratio.
396 */
397 virtual const IParticleParameter& getAspect() const = 0;
398 virtual IParticleParameter& getAspect() = 0;
399
400 /**
401 * Get the particle speed.
402 */
403 virtual const IParticleParameter& getSpeed() const = 0;
404 virtual IParticleParameter& getSpeed() = 0;
405
406 /**
407 * Get the particle rotation speed.
408 */
409 virtual const IParticleParameter& getRotationSpeed() const = 0;
410 virtual IParticleParameter& getRotationSpeed() = 0;
411
412 // Comparison operator - particle stages are considered equal
413 // if all properties are equal
414 virtual bool isEqualTo(const Ptr& other) = 0;
415
416 /**
417 * Copy operator, copies all properties from the other stage into this one.
418 */
419 virtual void copyFrom(const Ptr& other) = 0;
420
421 /**
422 * Returns the stage visibility. This flag is used in the Particle Editor context only,
423 * it is not saved to the .prt file therefore it has no effect within the Doom 3 engine.
424 */
425 virtual bool isVisible() const = 0;
426
427 /**
428 * Sets the stage visibility. This flag is used in the Particle Editor context only,
429 * it is not saved to the .prt file therefore it has no effect within the Doom 3 engine.
430 */
431 virtual void setVisible(bool visible) = 0;
432 };
433
434 } // namespace