Open Source Tomb Raider Engine
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Particle.h 5.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. /* -*- Mode: C++; tab-width: 3; indent-tabs-mode: t; c-basic-offset: 3 -*- */
  2. /*================================================================
  3. *
  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. #ifndef __FREYJA_MONGOOSE_PARTICLE_H_
  22. #define __FREYJA_MONGOOSE_PARTICLE_H_
  23. #include "hel/math.h"
  24. class Particle
  25. {
  26. public:
  27. Particle();
  28. /*------------------------------------------------------
  29. * Pre :
  30. * Post : Constructs an object of Particle
  31. *
  32. *-- History ------------------------------------------
  33. *
  34. * 2001.08.13:
  35. * Mongoose - Created
  36. ------------------------------------------------------*/
  37. ~Particle();
  38. /*------------------------------------------------------
  39. * Pre : Particle object is allocated
  40. * Post : Deconstructs an object of Particle
  41. *
  42. *-- History ------------------------------------------
  43. *
  44. * 2001.08.13:
  45. * Mongoose - Created
  46. ------------------------------------------------------*/
  47. void setActive(bool active);
  48. /*------------------------------------------------------
  49. * Pre :
  50. * Post : Toggles active state of particle
  51. *
  52. *-- History ------------------------------------------
  53. *
  54. * 2001.08.13:
  55. * Mongoose - Created
  56. ------------------------------------------------------*/
  57. void Force(float x, float y, float z);
  58. /*------------------------------------------------------
  59. * Pre :
  60. * Post : Sets gravity/force acting on particle
  61. *
  62. *-- History ------------------------------------------
  63. *
  64. * 2001.08.13:
  65. * Mongoose - Created
  66. ------------------------------------------------------*/
  67. void Reset();
  68. /*------------------------------------------------------
  69. * Pre :
  70. * Post : Resets particle to defaults
  71. *
  72. *-- History ------------------------------------------
  73. *
  74. * 2001.08.13:
  75. * Mongoose - Created
  76. ------------------------------------------------------*/
  77. void Speed(float x, float y, float z);
  78. /*------------------------------------------------------
  79. * Pre : note speed inits at 2000, lower is faster
  80. * Post : Sets particle speed
  81. *
  82. *-- History ------------------------------------------
  83. *
  84. * 2001.08.14:
  85. * Mongoose - Created
  86. ------------------------------------------------------*/
  87. void Color(float r, float g, float b);
  88. /*------------------------------------------------------
  89. * Pre : r,g,b are colors 0.0 to 1.0
  90. * Post : Sets new particle coloring
  91. *
  92. * NOTE : White {1.0, 1.0, 1.0} is the init color
  93. *
  94. *-- History ------------------------------------------
  95. *
  96. * 2001.08.14:
  97. * Mongoose - Created
  98. ------------------------------------------------------*/
  99. void Pos(float *x, float *y, float *z);
  100. /*------------------------------------------------------
  101. * Pre : x,y,z exist
  102. * Post : Returns position of particle in 3 space
  103. *
  104. *-- History ------------------------------------------
  105. *
  106. * 2001.08.13:
  107. * Mongoose - Created
  108. ------------------------------------------------------*/
  109. void Color(float *r, float *g, float *b);
  110. /*------------------------------------------------------
  111. * Pre : r,g,b exist
  112. * Post : Returns current color of particle
  113. *
  114. *-- History ------------------------------------------
  115. *
  116. * 2001.08.13:
  117. * Mongoose - Created
  118. ------------------------------------------------------*/
  119. float Life();
  120. /*------------------------------------------------------
  121. * Pre :
  122. * Post : Returns current life ( blend ) of particle
  123. *
  124. *-- History ------------------------------------------
  125. *
  126. * 2001.08.13:
  127. * Mongoose - Created
  128. ------------------------------------------------------*/
  129. void Update();
  130. /*------------------------------------------------------
  131. * Pre :
  132. * Post : Ajusts for particle life cycle
  133. *
  134. *-- History ------------------------------------------
  135. *
  136. * 2001.08.13:
  137. * Mongoose - Created
  138. ------------------------------------------------------*/
  139. int Texture();
  140. /*------------------------------------------------------
  141. * Pre :
  142. * Post : Returens texture binding for this particle
  143. *
  144. *-- History ------------------------------------------
  145. *
  146. * 2001.08.13:
  147. * Mongoose - Created
  148. ------------------------------------------------------*/
  149. bool isActive();
  150. /*------------------------------------------------------
  151. * Pre :
  152. * Post : Returns active value
  153. *
  154. *-- History ------------------------------------------
  155. *
  156. * 2001.08.13:
  157. * Mongoose - Created
  158. ------------------------------------------------------*/
  159. void TextureId(int t);
  160. /*------------------------------------------------------
  161. * Pre :
  162. * Post :
  163. *
  164. *-- History ------------------------------------------
  165. *
  166. * 2001.08.13:
  167. * Mongoose - Created
  168. ------------------------------------------------------*/
  169. private:
  170. bool _active; /* Is this particle in use? */
  171. float _life; /* Life of particle */
  172. float _blend; /* Blend amount or fade */
  173. int _texture; /* Texture polygon to use */
  174. vec3_t _pos; /* Current position in 3 space */
  175. vec3_t _color; /* Current color */
  176. vec3_t _dir; /* Current direction */
  177. vec3_t _force; /* Current force or 'gravity' */
  178. vec3_t _speed; /* Speed of particle movement */
  179. };
  180. #endif