ClampVelocityModule.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. //
  2. // ClampVelocityModule.h
  3. // cocos2d_libs
  4. //
  5. // Created by 徐俊杰 on 2020/4/24.
  6. //
  7. #ifndef ClampVelocityModule_h
  8. #define ClampVelocityModule_h
  9. //#include "cocos2d.h"
  10. #include "rparticle/Macros/RParticleMacros.h"
  11. #include "rparticle/Modules/ParticleSystemModule.h"
  12. #include "rparticle/ParticleSystemCurves.h"
  13. NS_RRP_BEGIN
  14. class ClampVelocityModule : public ParticleSystemModule
  15. {
  16. public:
  17. DECLARE_MODULE (ClampVelocityModule)
  18. ClampVelocityModule ();
  19. void Update (const ParticleSystemReadOnlyState& roState, const ParticleSystemState& state, ParticleSystemParticles& ps, const size_t fromIndex, const size_t toIndex, float dt);
  20. void CheckConsistency ();
  21. template<class TransferFunction>
  22. void Transfer (TransferFunction& transfer);
  23. inline MinMaxCurve& GetXCurve() { return m_X; };
  24. inline MinMaxCurve& GetYCurve() { return m_Y; };
  25. inline MinMaxCurve& GetZCurve() { return m_Z; };
  26. inline MinMaxCurve& GetMagnitude() { return m_Magnitude; };
  27. inline MinMaxCurve& GetDrag() { return m_Drag; };
  28. void SetInWorldSpace(bool value) { m_InWorldSpace = value; }
  29. bool GetInWorldSpace() const { return m_InWorldSpace; }
  30. void SetSeparateAxis(bool value) { m_SeparateAxis = value; }
  31. bool GetSeparateAxis() const { return m_SeparateAxis; }
  32. void SetMultiplyDragByParticleSize(bool value) { m_MultiplyDragByParticleSize = value; }
  33. bool GetMultiplyDragByParticleSize() const { return m_MultiplyDragByParticleSize; }
  34. void SetMultiplyDragByParticleVelocity(bool value) { m_MultiplyDragByParticleVelocity = value; }
  35. bool GetMultiplyDragByParticleVelocity() const { return m_MultiplyDragByParticleVelocity; }
  36. void SetDampen(float value) { m_Dampen = value; }
  37. float GetDampen() const { return m_Dampen; }
  38. private:
  39. MinMaxCurve m_X;
  40. MinMaxCurve m_Y;
  41. MinMaxCurve m_Z;
  42. MinMaxCurve m_Magnitude;
  43. MinMaxCurve m_Drag;
  44. bool m_InWorldSpace;
  45. bool m_SeparateAxis;
  46. bool m_MultiplyDragByParticleSize;
  47. bool m_MultiplyDragByParticleVelocity;
  48. float m_Dampen;
  49. };
  50. NS_RRP_END
  51. #endif /* ClampVelocityModule_h */