Open Source Tomb Raider Engine
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

Emitter.h 7.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  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 : Emitter
  9. * License : No use w/o permission (C)2001Mongoose
  10. * Comments: Particle emitter for freyja
  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 - Now using new Particle class!
  20. *
  21. * 2001.06.30:
  22. * Mongoose - Created
  23. ================================================================*/
  24. #ifndef _EMITTER_H_
  25. #define _EMITTER_H_
  26. #include <Particle.h>
  27. class Emitter
  28. {
  29. public:
  30. typedef enum
  31. {
  32. fUseFrustumCulling = 1,
  33. fUseDepthSorting = 2
  34. } EmitterFlags;
  35. Emitter(const char *name, int n);
  36. /*------------------------------------------------------
  37. * Pre : name is a valid C string
  38. * n is a number greater than 0
  39. *
  40. * Post : Constructs an object of Emitter
  41. *
  42. *-- History ------------------------------------------
  43. *
  44. * 2001.06.30:
  45. * Mongoose - Created
  46. ------------------------------------------------------*/
  47. ~Emitter();
  48. /*------------------------------------------------------
  49. * Pre : Emitter object is allocated
  50. * Post : Deconstructs an object of Emitter
  51. *
  52. *-- History ------------------------------------------
  53. *
  54. * 2001.06.30:
  55. * Mongoose - Created
  56. ------------------------------------------------------*/
  57. Particle *Particles();
  58. /*------------------------------------------------------
  59. * Pre :
  60. * Post : Returns particle array
  61. *
  62. *-- History ------------------------------------------
  63. *
  64. * 2001.08.14:
  65. * Mongoose - Created
  66. ------------------------------------------------------*/
  67. int Count();
  68. /*------------------------------------------------------
  69. * Pre :
  70. * Post : Returns number of particles emitted
  71. *
  72. *-- History ------------------------------------------
  73. *
  74. * 2001.08.14:
  75. * Mongoose - Created
  76. ------------------------------------------------------*/
  77. void Pos(float x, float y, float z);
  78. /*------------------------------------------------------
  79. * Pre : x,y,z exist
  80. * Post : Sets position of emitter in 3 space
  81. *
  82. *-- History ------------------------------------------
  83. *
  84. * 2001.08.13:
  85. * Mongoose - Created
  86. ------------------------------------------------------*/
  87. void Pos(float *x, float *y, float *z);
  88. /*------------------------------------------------------
  89. * Pre : x,y,z exist
  90. * Post : Returns position of emitter in 3 space
  91. *
  92. *-- History ------------------------------------------
  93. *
  94. * 2001.08.13:
  95. * Mongoose - Created
  96. ------------------------------------------------------*/
  97. void Orientation(float x, float y, float z);
  98. /*------------------------------------------------------
  99. * Pre : x,y,z exist
  100. * Post : Sets orientation of emitter in 3 space
  101. *
  102. *-- History ------------------------------------------
  103. *
  104. * 2001.08.13:
  105. * Mongoose - Created
  106. ------------------------------------------------------*/
  107. void Orientation(float *x, float *y, float *z);
  108. /*------------------------------------------------------
  109. * Pre : x,y,z exist
  110. * Post : Returns orientation of emitter in 3 space
  111. *
  112. *-- History ------------------------------------------
  113. *
  114. * 2001.08.13:
  115. * Mongoose - Created
  116. ------------------------------------------------------*/
  117. unsigned int Flags();
  118. /*------------------------------------------------------
  119. * Pre :
  120. * Post : Returns emitter flags
  121. *
  122. *-- History ------------------------------------------
  123. *
  124. * 2001.08.14:
  125. * Mongoose - Created
  126. ------------------------------------------------------*/
  127. void Flags(unsigned int flag, bool op);
  128. /*------------------------------------------------------
  129. * Pre :
  130. * Post : Set and Unset flag with op
  131. *
  132. * true - set
  133. * flase - unset
  134. *
  135. *-- History ------------------------------------------
  136. *
  137. * 2001.08.14:
  138. * Mongoose - Created
  139. ------------------------------------------------------*/
  140. void ParticleArray(int n);
  141. /*------------------------------------------------------
  142. * Pre : n is a number greater than 0
  143. * Post : Allocates the particle array and sets the count.
  144. * If the array has been allocated previously, then
  145. * the array is deallocated and a new one made.
  146. *
  147. *
  148. *-- History ------------------------------------------
  149. *
  150. * 2001.08.13:
  151. * Mongoose - Created
  152. ------------------------------------------------------*/
  153. void Draw();
  154. /*------------------------------------------------------
  155. * Pre :
  156. * Post : Renders particles
  157. *
  158. *-- History ------------------------------------------
  159. *
  160. * 2001.06.30:
  161. * Mongoose - Created
  162. ------------------------------------------------------*/
  163. void Name(const char *name);
  164. /*------------------------------------------------------
  165. * Pre : name is a valid C string
  166. * Post : Sets the emitters name
  167. *
  168. *-- History ------------------------------------------
  169. *
  170. * 2001.08.13:
  171. * Mongoose - Created
  172. ------------------------------------------------------*/
  173. void SetTextureId(int id);
  174. /*------------------------------------------------------
  175. * Pre :
  176. * Post : Resets all particle texture ids
  177. *
  178. *-- History ------------------------------------------
  179. *
  180. * 2001.08.13:
  181. * Mongoose - Created
  182. ------------------------------------------------------*/
  183. void TextureId(unsigned int particle_start, unsigned int particle_end,
  184. int id);
  185. /*------------------------------------------------------
  186. * Pre : particle_start and particle_end are a valid
  187. * range of particles in the array
  188. *
  189. * id is a valid texture id
  190. *
  191. * Post :
  192. *
  193. *-- History ------------------------------------------
  194. *
  195. * 2001.08.14:
  196. * Mongoose - Created
  197. ------------------------------------------------------*/
  198. void Color(unsigned int particle_start, unsigned int particle_end,
  199. float r, float g, float b);
  200. /*------------------------------------------------------
  201. * Pre : particle_start and particle_end are a valid
  202. * range of particles in the array
  203. *
  204. * r,g,b are colors 0.0 to 1.0
  205. *
  206. * Post :
  207. *
  208. *-- History ------------------------------------------
  209. *
  210. * 2001.08.14:
  211. * Mongoose - Created
  212. ------------------------------------------------------*/
  213. void Speed(unsigned int particle_start, unsigned int particle_end,
  214. float x, float y, float z);
  215. /*------------------------------------------------------
  216. * Pre : particle_start and particle_end are a valid
  217. * range of particles in the array
  218. *
  219. * take note speed inits at 2000, lower is faster
  220. *
  221. * Post :
  222. *
  223. *-- History ------------------------------------------
  224. *
  225. * 2001.08.14:
  226. * Mongoose - Created
  227. ------------------------------------------------------*/
  228. void Force(unsigned int particle_start, unsigned int particle_end,
  229. float x, float y, float z);
  230. /*------------------------------------------------------
  231. * Pre : particle_start and particle_end are a valid
  232. * range of particles in the array
  233. *
  234. * Force/Gravity acting on particles
  235. *
  236. * Post :
  237. *
  238. *-- History ------------------------------------------
  239. *
  240. * 2001.08.14:
  241. * Mongoose - Created
  242. ------------------------------------------------------*/
  243. static vec_t mFrustum[6][4]; /* View Volume copy */
  244. private:
  245. char *_name; /* Emitter name */
  246. unsigned int _flags; /* Emitter flags */
  247. vec3_t _pos; /* Position in 3 space */
  248. vec3_t _mangle; /* Oreintation in 3 space */
  249. Particle *_particle; /* Array of particles */
  250. unsigned int _count; /* Particle count */
  251. };
  252. #endif