-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAnimationManager.h
57 lines (44 loc) · 1.25 KB
/
AnimationManager.h
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
52
53
54
55
56
57
/*
* AnimationManager.h
*
* Created on: 18 kwi 2020
* Author: andr
*/
#ifndef ANIMATIONMANAGER_H_
#define ANIMATIONMANAGER_H_
#include "GltfBase.h"
#include "GraphObject.h"
struct Animation
{
std::vector<float > TimePoints;
std::vector<float > Values;
std::vector<glm::vec3 > Values3;
std::vector<glm::vec4 > Values4;
std::string function;
std::string name;
float GetInterpolatedValue(float time);
glm::vec4 GetInterpolatedValue4(float time);
Animation(AnimationNode * anim_node, GltfBase * base);
Animation();
};
class AnimationManager
{
float AnimationsLength;
float CurrentTime;
public:
std::map<int, std::vector<Animation *> > Animations;
std::map<int, Animation *> CurrentAnimations;
std::map<int, float> StartPlayTimes;
GltfBase * Base;
AnimationManager();
void Init(GltfBase * gltf_base);
Animation * Get(int nodeid, std::string name);
Animation * Add(int nodeid, AnimationNode * node);
void Loop(int nodeid, Animation * anim);
void Play(int nodeid, Animation * anim);
void Stop(int nodeid, Animation * anim);
float GetInterpolatedValue(int nodeid, float time);
glm::vec4 GetInterpolatedValue4(int nodeid, float time);
void Update(float time);
};
#endif /* ANIMATIONMANAGER_H_ */