Open Source Tomb Raider Engine
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

Particle.h 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /*!
  2. * \file include/Particle.h
  3. * \brief Particle system base header
  4. *
  5. * \author Mongoose
  6. */
  7. #ifndef _PARTICLE_H_
  8. #define _PARTICLE_H_
  9. #include <MatMath.h>
  10. /*!
  11. * \brief Partcle systems atomic base
  12. */
  13. class Particle {
  14. public:
  15. /*!
  16. * \brief Constructs an object of Sound
  17. */
  18. Particle();
  19. /*!
  20. * \brief Deconstructs an object of Sound
  21. */
  22. ~Particle();
  23. /*!
  24. * \brief Toggles active state of particle
  25. * \param active new state
  26. */
  27. void setActive(bool active);
  28. /*!
  29. * \brief Sets gravity/force acting on particle
  30. * \param x X part of force vector
  31. * \param y Y part
  32. * \param z Z part
  33. */
  34. void Force(float x, float y, float z);
  35. /*!
  36. * \brief Resets particle to defaults
  37. */
  38. void Reset();
  39. /*!
  40. * \brief Sets gravity/force acting on particle
  41. * \note speed inits at 2000, lower is faster
  42. * \param x X part of speed vector
  43. * \param y Y part
  44. * \param z Z part
  45. */
  46. void Speed(float x, float y, float z);
  47. /*!
  48. * \brief Sets new particle coloring
  49. * \note White {1.0, 1.0, 1.0} is the init color
  50. * \param r Red part, from 0.0 to 1.0
  51. * \param g Green part, from 0.0 to 1.0
  52. * \param b Blue part, from 0.0 to 1.0
  53. */
  54. void Color(float r, float g, float b);
  55. /*!
  56. * \brief Returns position of particle in 3 space
  57. * \param x not NULL!
  58. * \param y not NULL!
  59. * \param z not NULL!
  60. */
  61. void Pos(float *x, float *y, float *z);
  62. /*!
  63. * \brief Returns current color of particle
  64. * \param r not NULL!
  65. * \param g not NULL!
  66. * \param b not NULL!
  67. */
  68. void Color(float *r, float *g, float *b);
  69. /*!
  70. * \brief Returns current life (blend) of particle
  71. * \returns fade of particle
  72. */
  73. float Life();
  74. /*!
  75. * \brief Adjusts for particle life cycle
  76. */
  77. void Update();
  78. /*!
  79. * \brief Returns texture binding for this particle
  80. * \returns texture id
  81. */
  82. int Texture();
  83. /*!
  84. * \brief Returns active value
  85. * \returns state
  86. */
  87. bool isActive();
  88. /*!
  89. * \brief Set the texture for this particle
  90. * \param t new texture id
  91. */
  92. void TextureId(int t);
  93. private:
  94. bool _active; //!< Is this particle in use?
  95. float _life; //!< Life of particle
  96. float _blend; //!< Blend amount or fade
  97. int _texture; //!< Texture polygon to use
  98. vec3_t _pos; //!< Current position in 3 space
  99. vec3_t _color; //!< Current color
  100. vec3_t _dir; //!< Current direction
  101. vec3_t _force; //!< Current force or 'gravity'
  102. vec3_t _speed; //!< Speed of particle movement
  103. };
  104. #endif