VelocityModule.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //
  2. // VelocityModule.h
  3. // cocos2d_libs
  4. //
  5. // Created by 徐俊杰 on 2020/4/24.
  6. //
  7. #ifndef VelocityModule_h
  8. #define VelocityModule_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 VelocityModule : public ParticleSystemModule
  16. {
  17. public:
  18. DECLARE_MODULE (VelocityModule)
  19. VelocityModule ();
  20. void Update (const ParticleSystemReadOnlyState& roState, const ParticleSystemState& state, ParticleSystemParticles& ps, const size_t fromIndex, const size_t toIndex);
  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. template<class TransferFunction>
  28. void Transfer (TransferFunction& transfer);
  29. void SetInWorldSpace(bool value) { m_InWorldSpace = value; }
  30. bool GetInWorldSpace() const { return m_InWorldSpace; }
  31. private:
  32. MinMaxCurve m_X;
  33. MinMaxCurve m_Y;
  34. MinMaxCurve m_Z;
  35. bool m_InWorldSpace;
  36. Rand m_Random;
  37. };
  38. NS_RRP_END
  39. #endif /* VelocityModule_h */