ForceModule.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. //
  2. // ForceModule.h
  3. // libcocos2d Mac
  4. //
  5. // Created by 徐俊杰 on 2020/4/24.
  6. //
  7. #ifndef ForceModule_h
  8. #define ForceModule_h
  9. //#include "cocos2d.h"
  10. #include "rparticle/Macros/RParticleMacros.h"
  11. #include "rparticle/Modules/ParticleSystemModule.h"
  12. #include "rparticle/ParticleSystemCurves.h"
  13. #include "rparticle/Math/Random/rand.h"
  14. NS_RRP_BEGIN
  15. class ForceModule : public ParticleSystemModule
  16. {
  17. public:
  18. DECLARE_MODULE (ForceModule)
  19. ForceModule ();
  20. void Update (const ParticleSystemReadOnlyState& roState, const ParticleSystemState& state, ParticleSystemParticles& ps, const size_t fromIndex, const size_t toIndex, float dt);
  21. void UpdateProcedural (const ParticleSystemReadOnlyState& roState, const ParticleSystemState& state, ParticleSystemParticles& ps);
  22. void CalculateProceduralBounds(MinMaxAABB& bounds, const Matrix4x4f& localToWorld, float maxLifeTime);
  23. void CheckConsistency() {};
  24. inline MinMaxCurve& GetXCurve() { return m_X; }
  25. inline MinMaxCurve& GetYCurve() { return m_Y; }
  26. inline MinMaxCurve& GetZCurve() { return m_Z; }
  27. inline bool GetRandomizePerFrame() { return m_RandomizePerFrame; }
  28. template<class TransferFunction>
  29. void Transfer (TransferFunction& transfer);
  30. void SetInWorldSpace(bool value) { m_InWorldSpace = value; }
  31. bool GetInWorldSpace() const { return m_InWorldSpace; }
  32. void SetRandomizePerFrame(bool value) { m_RandomizePerFrame = value; }
  33. bool GetRandomizePerFrame() const { return m_RandomizePerFrame; }
  34. private:
  35. MinMaxCurve m_X;
  36. MinMaxCurve m_Y;
  37. MinMaxCurve m_Z;
  38. bool m_InWorldSpace;
  39. bool m_RandomizePerFrame;
  40. Rand m_Random;
  41. };
  42. NS_RRP_END
  43. #endif /* ForceModule_h */