From 15740faf9fe9fe4be08965098bbf2947e096aeeb Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 14 Aug 2019 22:50:43 +0800 Subject: +Unity Runtime code --- Runtime/Animation/AvatarPlayback.h | 51 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 Runtime/Animation/AvatarPlayback.h (limited to 'Runtime/Animation/AvatarPlayback.h') diff --git a/Runtime/Animation/AvatarPlayback.h b/Runtime/Animation/AvatarPlayback.h new file mode 100644 index 0000000..75e9ff4 --- /dev/null +++ b/Runtime/Animation/AvatarPlayback.h @@ -0,0 +1,51 @@ +#ifndef AVATARPLAYBACK_H +#define AVATARPLAYBACK_H + +#include "Runtime/Animation/MecanimUtility.h" + +namespace mecanim +{ + namespace animation + { + struct AvatarMemory ; + } +} + +class AvatarFrame +{ +public: + AvatarFrame() : m_AvatarMemory(0), m_CurrentTime(0) {} + mecanim::animation::AvatarMemory* m_AvatarMemory; + float m_CurrentTime; +}; + +class AvatarPlayback +{ +public: + + AvatarPlayback(MemLabelId label); + + void Clear(); + mecanim::animation::AvatarMemory* PlayFrame(float time, float& effectiveTime); + void RecordFrame(float deltaTime, const mecanim::animation::AvatarMemory* srcMemory); + + void Init(int frameCount); + + float StartTime(); + float StopTime(); + float CursorTime(); + + +private: + std::vector m_Frames; + + int m_FrameCount; + int m_StartIndex; + int m_StopIndex; + int m_CursorIndex; + + int NextIndex(int index); + mecanim::memory::MecanimAllocator m_Alloc; +}; + +#endif // AVATARPLAYBACK_H -- cgit v1.1-26-g67d0