ParticleEmitter.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #ifndef _PARTICLEEMITTER_H_
  2. #define _PARTICLEEMITTER_H_
  3. #include "Common.h"
  4. #include "Node.h"
  5. #include "MeshNode.h"
  6. #include "GhostNode.h"
  7. #include "PhyCommon.h"
  8. /**
  9. *
  10. */
  11. class ParticleEmitter: public Node
  12. {
  13. public:
  14. /**
  15. * @brief The scene node particle class
  16. */
  17. class Particle: public GhostNode
  18. {
  19. public:
  20. int lifeTillDeath; ///< Life till death. If < 0 then dead. In ms
  21. btRigidBody* body;
  22. Particle(): lifeTillDeath(-1) {}
  23. void render();
  24. void renderDepth() {};
  25. };
  26. // the properties
  27. uint minParticleLife;
  28. uint maxParticleLife;
  29. Vec3 minDirection;
  30. Vec3 maxDirection;
  31. float minForceMagnitude;
  32. float maxForceMagnitude;
  33. float minParticleMass;
  34. float maxParticleMass;
  35. Vec3 minGravity;
  36. Vec3 maxGravity;
  37. Vec3 minInitialPos;
  38. Vec3 maxInitialPos;
  39. uint maxNumOfParticles; ///< The size of the particles vector
  40. uint emittionPeriod; ///< How often the emitter emits new particles. In ms
  41. uint particlesPerEmittion; ///< How many particles are emitted every emittion
  42. // the changeable vars
  43. Vec<Particle*> particles;
  44. uint timeOfPrevUpdate;
  45. uint timeOfPrevEmittion;
  46. // funcs
  47. ParticleEmitter(): Node( NT_PARTICLE_EMITTER ) {}
  48. void render();
  49. void renderDepth() {}
  50. void init( const char* filename );
  51. void deinit() {}
  52. void update();
  53. };
  54. #endif