Open Source Tomb Raider Engine
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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 "utils/math.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 Toggles active state of particle
  21. * \param active new state
  22. */
  23. void setActive(bool active);
  24. /*!
  25. * \brief Sets gravity/force acting on particle
  26. * \param x X part of force vector
  27. * \param y Y part
  28. * \param z Z part
  29. */
  30. void Force(float x, float y, float z);
  31. /*!
  32. * \brief Resets particle to defaults
  33. */
  34. void Reset();
  35. /*!
  36. * \brief Sets gravity/force acting on particle
  37. * \note speed inits at 2000, lower is faster
  38. * \param x X part of speed vector
  39. * \param y Y part
  40. * \param z Z part
  41. */
  42. void Speed(float x, float y, float z);
  43. /*!
  44. * \brief Sets new particle coloring
  45. * \note White {1.0, 1.0, 1.0} is the init color
  46. * \param r Red part, from 0.0 to 1.0
  47. * \param g Green part, from 0.0 to 1.0
  48. * \param b Blue part, from 0.0 to 1.0
  49. */
  50. void Color(float r, float g, float b);
  51. /*!
  52. * \brief Returns position of particle in 3 space
  53. * \param x not NULL!
  54. * \param y not NULL!
  55. * \param z not NULL!
  56. */
  57. void Pos(float *x, float *y, float *z);
  58. /*!
  59. * \brief Returns current color of particle
  60. * \param r not NULL!
  61. * \param g not NULL!
  62. * \param b not NULL!
  63. */
  64. void Color(float *r, float *g, float *b);
  65. /*!
  66. * \brief Returns current life (blend) of particle
  67. * \returns fade of particle
  68. */
  69. float Life();
  70. /*!
  71. * \brief Adjusts for particle life cycle
  72. */
  73. void Update();
  74. /*!
  75. * \brief Returns texture binding for this particle
  76. * \returns texture id
  77. */
  78. int Texture();
  79. /*!
  80. * \brief Returns active value
  81. * \returns state
  82. */
  83. bool isActive();
  84. /*!
  85. * \brief Set the texture for this particle
  86. * \param t new texture id
  87. */
  88. void TextureId(int t);
  89. private:
  90. bool _active; //!< Is this particle in use?
  91. float _life; //!< Life of particle
  92. float _blend; //!< Blend amount or fade
  93. int _texture; //!< Texture polygon to use
  94. vec3_t _pos; //!< Current position in 3 space
  95. vec3_t _color; //!< Current color
  96. vec3_t _dir; //!< Current direction
  97. vec3_t _force; //!< Current force or 'gravity'
  98. vec3_t _speed; //!< Speed of particle movement
  99. };
  100. #endif