-
Notifications
You must be signed in to change notification settings - Fork 5
/
animator.h
53 lines (42 loc) · 1.08 KB
/
animator.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
#ifndef animator_hpp
#define animator_hpp
#include <vector>
#include <string>
#include <map>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <assimp/scene.h>
#include "animation.h"
#define MAX_BONES 200
class Anim
{
public:
Anim(Animation *animation);
Animation *m_animation;
float m_blendFactor;
float m_playbackSpeed;
bool m_timerActive;
float m_timer;
void updateTimer(float deltaTime, float startOffset);
};
struct AnimatorState
{
std::vector<Anim *> animations;
std::vector<Anim *> poses;
};
class Animator
{
public:
std::vector<glm::mat4> m_finalBoneMatrices;
std::vector<glm::mat4> m_globalMatrices;
std::vector<Animation *> m_animations;
AnimatorState m_state;
float m_startOffset = 0.f;
Animator(std::vector<Animation *> animations);
~Animator();
void update(float deltaTime);
void calculateBoneTransform(const AssimpNodeData *node, glm::mat4 parentTransform);
Anim *addStateAnimation(Animation *animation);
Anim *addPoseAnimation(Animation *animation);
};
#endif /* animator_hpp */