diff options
author | chai <chaifix@163.com> | 2019-08-14 22:50:43 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-08-14 22:50:43 +0800 |
commit | 15740faf9fe9fe4be08965098bbf2947e096aeeb (patch) | |
tree | a730ec236656cc8cab5b13f088adfaed6bb218fb /Runtime/Filters/Particles/ParticleAnimator.h |
Diffstat (limited to 'Runtime/Filters/Particles/ParticleAnimator.h')
-rw-r--r-- | Runtime/Filters/Particles/ParticleAnimator.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/Runtime/Filters/Particles/ParticleAnimator.h b/Runtime/Filters/Particles/ParticleAnimator.h new file mode 100644 index 0000000..dde7b9d --- /dev/null +++ b/Runtime/Filters/Particles/ParticleAnimator.h @@ -0,0 +1,57 @@ +#ifndef PARTICLEANIMATOR_H +#define PARTICLEANIMATOR_H + +#include "Runtime/BaseClasses/GameObject.h" +#include "Runtime/Math/Color.h" +#include "ParticleStruct.h" + + + +class ParticleAnimator : public Unity::Component +{ +public: + REGISTER_DERIVED_CLASS (ParticleAnimator, Unity::Component) + DECLARE_OBJECT_SERIALIZE (ParticleAnimator) + + ParticleAnimator(MemLabelId label, ObjectCreationMode mode); + + static void InitializeClass (); + static void CleanupClass (); + + enum { kColorKeys = 5 }; + + GET_SET_DIRTY (Vector3f, WorldRotationAxis, m_WorldRotationAxis) + GET_SET_DIRTY (Vector3f, LocalRotationAxis, m_LocalRotationAxis) + GET_SET_DIRTY (Vector3f, RndForce, m_RndForce) + GET_SET_DIRTY (Vector3f, Force, m_Force) + GET_SET_DIRTY (float, Damping, m_Damping) + GET_SET_DIRTY (float, SizeGrow, m_SizeGrow) + GET_SET_DIRTY (bool, Autodestruct, m_Autodestruct) + GET_SET_DIRTY (bool, DoesAnimateColor, m_DoesAnimateColor) + GET_SET_DIRTY (bool, stopSimulation, m_StopSimulation) + + void GetColorAnimation(ColorRGBAf *col) const; + void SetColorAnimation(ColorRGBAf *col); + + void UpdateAnimator( ParticleArray& particles, PrivateParticleInfo& privateInfo, float deltaTime ); + + bool WillAutoDestructIfNoParticles( const PrivateParticleInfo& privateInfo ) const; + +private: + void UpdateParticles (ParticleArray& particles, PrivateParticleInfo& privateInfo, float deltaTime) const; + +private: + Vector3f m_WorldRotationAxis; // axis around which the particle rotates, worldspace + Vector3f m_LocalRotationAxis; // axis around which the particle rotates, localspace + Vector3f m_RndForce;// rnd force + Vector3f m_Force; // gravity value + float m_Damping; // damping value + float m_SizeGrow; // Grows the size of the particle by sizeGrow per second. A value of 1.0 doubles the particle size every second. + ColorRGBA32 m_ColorAnimation[kColorKeys]; // Animates the color through the color keys + int m_Autodestruct; + bool m_DoesAnimateColor; + bool m_StopSimulation; + float m_EnergylossFraction; +}; + +#endif |