123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- #ifndef __CCANIMATIONCURVE_H__
- #define __CCANIMATIONCURVE_H__
- #include <cmath>
- #include <functional>
- #include "platform/CCPlatformMacros.h"
- #include "base/CCRef.h"
- #include "math/CCMath.h"
- #if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
- #undef NEAR
- #endif
- NS_CC_BEGIN
- enum class EvaluateType
- {
- INT_LINEAR,
- INT_NEAR,
- INT_QUAT_SLERP,
- INT_USER_FUNCTION,
- };
- template <int componentSize>
- class AnimationCurve: public Ref
- {
- public:
-
-
- static AnimationCurve* create(float* keytime, float* value, int count);
-
-
- void evaluate(float time, float* dst, EvaluateType type) const;
-
-
- void setEvaluateFun(std::function<void(float time, float* dst)> fun);
-
-
- float getStartTime() const;
-
-
- float getEndTime() const;
-
- CC_CONSTRUCTOR_ACCESS:
-
- AnimationCurve();
- virtual ~AnimationCurve();
-
-
- int determineIndex(float time) const;
-
- protected:
-
- float* _value;
- float* _keytime;
- int _count;
- int _componentSizeByte;
-
- std::function<void(float time, float* dst)> _evaluateFun;
- };
- NS_CC_END
- #include "3d/CCAnimationCurve.inl"
- #endif
|