SubEmitterModule.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. //
  2. // SubEmitterModule.h
  3. // cocos2d_libs
  4. //
  5. // Created by 徐俊杰 on 2021/7/5.
  6. //
  7. #ifndef SubEmitterModule_h
  8. #define SubEmitterModule_h
  9. //#include "cocos2d.h"
  10. #include "rparticle/Macros/RParticleMacros.h"
  11. #include "rparticle/Modules/ParticleSystemModule.h"
  12. NS_RRP_BEGIN
  13. class RParticleSystem;
  14. struct ParticleSystemParticles;
  15. class SubEmitterModule : public ParticleSystemModule
  16. {
  17. public:
  18. enum InheritedProperties
  19. {
  20. kInheritColor = (1 << 0),
  21. kInheritSize = (1 << 1),
  22. kInheritRotation = (1 << 2),
  23. kInheritLifetime = (1 << 3),
  24. kInheritDuration = (1 << 4)
  25. };
  26. DECLARE_MODULE (SubEmitterModule)
  27. SubEmitterModule();
  28. void CheckConsistency() {};
  29. template<class TransferFunction>
  30. void Transfer (TransferFunction& transfer);
  31. int GetSubEmitterType() const { return m_SubEmitterType; }
  32. void SetSubEmitterType(int value) { m_SubEmitterType = value; }
  33. int GetProperties() const { return m_Properties; }
  34. //void SetProperties(int value) { m_Properties = value; }
  35. bool GetInheritColor() const { return m_Properties & kInheritColor; }
  36. void SetInheritColor(bool value) { value ? m_Properties |= kInheritColor : m_Properties &= ~kInheritColor; }
  37. bool GetInheritSize() const { return m_Properties & kInheritSize; }
  38. void SetInheritSize(bool value) { value ? m_Properties |= kInheritSize : m_Properties &= ~kInheritSize; }
  39. bool GetInheritRotation() const { return m_Properties & kInheritRotation; }
  40. void SetInheritRotation(bool value) { value ? m_Properties |= kInheritRotation : m_Properties &= ~kInheritRotation; }
  41. bool GetInheritLifetime() const { return m_Properties & kInheritLifetime; }
  42. void SetInheritLifetime(bool value) { value ? m_Properties |= kInheritLifetime : m_Properties &= ~kInheritLifetime; }
  43. bool GetInheritDuration() const { return m_Properties & kInheritDuration; }
  44. void SetInheritDuration(bool value) { value ? m_Properties |= kInheritDuration : m_Properties &= ~kInheritDuration; }
  45. private:
  46. int m_SubEmitterType; //ParticleSystemSubType
  47. int m_Properties;
  48. };
  49. NS_RRP_END
  50. #endif /* SubEmitterModule_h */