IParticleAffector.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // Copyright (C) 2002-2012 Nikolaus Gebhardt
  2. // This file is part of the "Irrlicht Engine".
  3. // For conditions of distribution and use, see copyright notice in irrlicht.h
  4. #ifndef IRR_I_PARTICLE_AFFECTOR_H_INCLUDED
  5. #define IRR_I_PARTICLE_AFFECTOR_H_INCLUDED
  6. #include "IAttributeExchangingObject.h"
  7. #include "SParticle.h"
  8. namespace irr
  9. {
  10. namespace scene
  11. {
  12. //! Types of built in particle affectors
  13. enum E_PARTICLE_AFFECTOR_TYPE
  14. {
  15. EPAT_NONE = 0,
  16. EPAT_ATTRACT,
  17. EPAT_FADE_OUT,
  18. EPAT_GRAVITY,
  19. EPAT_ROTATE,
  20. EPAT_SCALE,
  21. EPAT_COUNT
  22. };
  23. //! Names for built in particle affectors
  24. const c8* const ParticleAffectorTypeNames[] =
  25. {
  26. "None",
  27. "Attract",
  28. "FadeOut",
  29. "Gravity",
  30. "Rotate",
  31. "Scale",
  32. 0
  33. };
  34. //! A particle affector modifies particles.
  35. class IParticleAffector : public virtual io::IAttributeExchangingObject
  36. {
  37. public:
  38. //! constructor
  39. IParticleAffector() : Enabled(true) {}
  40. //! Affects an array of particles.
  41. /** \param now Current time. (Same as ITimer::getTime() would return)
  42. \param particlearray Array of particles.
  43. \param count Amount of particles in array. */
  44. virtual void affect(u32 now, SParticle* particlearray, u32 count) = 0;
  45. //! Sets whether or not the affector is currently enabled.
  46. virtual void setEnabled(bool enabled) { Enabled = enabled; }
  47. //! Gets whether or not the affector is currently enabled.
  48. virtual bool getEnabled() const { return Enabled; }
  49. //! Get emitter type
  50. virtual E_PARTICLE_AFFECTOR_TYPE getType() const = 0;
  51. protected:
  52. bool Enabled;
  53. };
  54. } // end namespace scene
  55. } // end namespace irr
  56. #endif