summaryrefslogtreecommitdiff
path: root/Runtime/Animation/AvatarPlayback.h
blob: 75e9ff43d4e435c6c9ae2b64bd9976b81b5cb69e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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<AvatarFrame> 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