12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- //
- // ForceModule.h
- // libcocos2d Mac
- //
- // Created by 徐俊杰 on 2020/4/24.
- //
- #ifndef ForceModule_h
- #define ForceModule_h
- //#include "cocos2d.h"
- #include "rparticle/Macros/RParticleMacros.h"
- #include "rparticle/Modules/ParticleSystemModule.h"
- #include "rparticle/ParticleSystemCurves.h"
- #include "rparticle/Math/Random/rand.h"
- NS_RRP_BEGIN
- class ForceModule : public ParticleSystemModule
- {
- public:
- DECLARE_MODULE (ForceModule)
- ForceModule ();
-
- void Update (const ParticleSystemReadOnlyState& roState, const ParticleSystemState& state, ParticleSystemParticles& ps, const size_t fromIndex, const size_t toIndex, float dt);
- void UpdateProcedural (const ParticleSystemReadOnlyState& roState, const ParticleSystemState& state, ParticleSystemParticles& ps);
- void CalculateProceduralBounds(MinMaxAABB& bounds, const Matrix4x4f& localToWorld, float maxLifeTime);
- void CheckConsistency() {};
-
- inline MinMaxCurve& GetXCurve() { return m_X; }
- inline MinMaxCurve& GetYCurve() { return m_Y; }
- inline MinMaxCurve& GetZCurve() { return m_Z; }
- inline bool GetRandomizePerFrame() { return m_RandomizePerFrame; }
-
- template<class TransferFunction>
- void Transfer (TransferFunction& transfer);
-
- void SetInWorldSpace(bool value) { m_InWorldSpace = value; }
- bool GetInWorldSpace() const { return m_InWorldSpace; }
- void SetRandomizePerFrame(bool value) { m_RandomizePerFrame = value; }
- bool GetRandomizePerFrame() const { return m_RandomizePerFrame; }
- private:
- MinMaxCurve m_X;
- MinMaxCurve m_Y;
- MinMaxCurve m_Z;
- bool m_InWorldSpace;
- bool m_RandomizePerFrame;
- Rand m_Random;
- };
- NS_RRP_END
- #endif /* ForceModule_h */
|