-
Notifications
You must be signed in to change notification settings - Fork 0
/
Animation.h
73 lines (51 loc) · 1.17 KB
/
Animation.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#pragma once
#include <glm\glm.hpp>
#include <iostream>
#include <fstream>
#include <GLFW\glfw3.h>
#undef _UNICODE
#include <IL\il.h>
#include <IL\ilu.h>
#include <IL\ilut.h>
#include "BVH.h"
#define MAX_BONE_SIZE 64
struct IDval
{
float value;
unsigned int ID;
};
class skinMesh
{
public:
float boneInfluenceIDs[4];
float weights[4];
skinMesh()
{
for (unsigned int i = 0; i < 4; ++i)
{
boneInfluenceIDs[i] = 0.0f;
weights[i] = 0.0f;
}
}
};
std::vector<skinMesh> LoadSkinWeightsXML(char* filePath);
std::vector<skinMesh> LoadSkinWeightsIMG(char* filePath, std::vector<glm::vec2> texcoords);
class AnimationManager
{
private:
std::vector<BVH> animations;
unsigned int currentAnimation;
unsigned int currentFrame;
unsigned int nextFrame;
float deltaTime;
double timeOfLastUpdate;
bool looping;
glm::mat4 boneTransformations[MAX_BONE_SIZE];
public:
AnimationManager();
~AnimationManager();
void SetAnimations(std::vector<BVH> newAnimations);
inline void SetCurrentAnimation(int animationIndex){ currentAnimation = animationIndex; }
void Update(Node *parent);
inline glm::mat4* GetBoneTransformations(void){ return boneTransformations; }
};