IParticleEmitter.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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_EMITTER_H_INCLUDED
  5. #define IRR_I_PARTICLE_EMITTER_H_INCLUDED
  6. #include "IAttributeExchangingObject.h"
  7. #include "SParticle.h"
  8. namespace irr
  9. {
  10. namespace scene
  11. {
  12. //! Types of built in particle emitters
  13. enum E_PARTICLE_EMITTER_TYPE
  14. {
  15. EPET_POINT = 0,
  16. EPET_ANIMATED_MESH,
  17. EPET_BOX,
  18. EPET_CYLINDER,
  19. EPET_MESH,
  20. EPET_RING,
  21. EPET_SPHERE,
  22. EPET_COUNT
  23. };
  24. //! Names for built in particle emitters
  25. const c8* const ParticleEmitterTypeNames[] =
  26. {
  27. "Point",
  28. "AnimatedMesh",
  29. "Box",
  30. "Cylinder",
  31. "Mesh",
  32. "Ring",
  33. "Sphere",
  34. 0
  35. };
  36. //! A particle emitter for using with particle systems.
  37. /** A Particle emitter emits new particles into a particle system.
  38. */
  39. class IParticleEmitter : public virtual io::IAttributeExchangingObject
  40. {
  41. public:
  42. //! Prepares an array with new particles to emit into the system
  43. /** \param now Current time.
  44. \param timeSinceLastCall Time elapsed since last call, in milliseconds.
  45. \param outArray Pointer which will point to the array with the new
  46. particles to add into the system.
  47. \return Amount of new particles in the array. Can be 0. */
  48. virtual s32 emitt(u32 now, u32 timeSinceLastCall, SParticle*& outArray) = 0;
  49. //! Set direction the emitter emits particles
  50. virtual void setDirection( const core::vector3df& newDirection ) = 0;
  51. //! Set minimum number of particles the emitter emits per second
  52. virtual void setMinParticlesPerSecond( u32 minPPS ) = 0;
  53. //! Set maximum number of particles the emitter emits per second
  54. virtual void setMaxParticlesPerSecond( u32 maxPPS ) = 0;
  55. //! Set minimum starting color for particles
  56. virtual void setMinStartColor( const video::SColor& color ) = 0;
  57. //! Set maximum starting color for particles
  58. virtual void setMaxStartColor( const video::SColor& color ) = 0;
  59. //! Set the maximum starting size for particles
  60. virtual void setMaxStartSize( const core::dimension2df& size ) = 0;
  61. //! Set the minimum starting size for particles
  62. virtual void setMinStartSize( const core::dimension2df& size ) = 0;
  63. //! Set the minimum particle life-time in milliseconds
  64. virtual void setMinLifeTime( u32 lifeTimeMin ) = 0;
  65. //! Set the maximum particle life-time in milliseconds
  66. virtual void setMaxLifeTime( u32 lifeTimeMax ) = 0;
  67. //! Set maximal random derivation from the direction
  68. virtual void setMaxAngleDegrees( s32 maxAngleDegrees ) = 0;
  69. //! Get direction the emitter emits particles
  70. virtual const core::vector3df& getDirection() const = 0;
  71. //! Get the minimum number of particles the emitter emits per second
  72. virtual u32 getMinParticlesPerSecond() const = 0;
  73. //! Get the maximum number of particles the emitter emits per second
  74. virtual u32 getMaxParticlesPerSecond() const = 0;
  75. //! Get the minimum starting color for particles
  76. virtual const video::SColor& getMinStartColor() const = 0;
  77. //! Get the maximum starting color for particles
  78. virtual const video::SColor& getMaxStartColor() const = 0;
  79. //! Get the maximum starting size for particles
  80. virtual const core::dimension2df& getMaxStartSize() const = 0;
  81. //! Get the minimum starting size for particles
  82. virtual const core::dimension2df& getMinStartSize() const = 0;
  83. //! Get the minimum particle life-time in milliseconds
  84. virtual u32 getMinLifeTime() const = 0;
  85. //! Get the maximum particle life-time in milliseconds
  86. virtual u32 getMaxLifeTime() const = 0;
  87. //! Get maximal random derivation from the direction
  88. virtual s32 getMaxAngleDegrees() const = 0;
  89. //! Get emitter type
  90. virtual E_PARTICLE_EMITTER_TYPE getType() const { return EPET_POINT; }
  91. };
  92. typedef IParticleEmitter IParticlePointEmitter;
  93. } // end namespace scene
  94. } // end namespace irr
  95. #endif