-
Notifications
You must be signed in to change notification settings - Fork 1
/
Joint.h
49 lines (25 loc) · 1.15 KB
/
Joint.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
#ifndef JOINT_H_
#define JOINT_H_
#include "Globals.h"
#include "Application.h"
class Joint
{
public:
Joint() {}
Joint(int index_, string name_, mat4x4 LocalBindTransform_) :index(index_), name(name_), LocalBindTransform(LocalBindTransform_) {};
~Joint();
public:
int index; //ID and also the order in the joints list
string name; //name that joint recieve from .dae file
vector<Joint*> children; //joint's childrens
mat4x4 AnimationTransform;
mat4x4 LocalBindTransform; //joint's local transform based on parent's transform
mat4x4 InverseBindTransform; //calculated using "LocalBindTransform" and is the bind transform of the jont in model space (inverted)
public:
void AddChild(Joint Child) { this->children.push_back(&Child); }
mat4x4 GetAnimationTransform() { return AnimationTransform; }
mat4x4 GetInverseBindTransform() { return InverseBindTransform; }
void SetAnimationTransform(mat4x4 AnimTransform) { AnimationTransform = AnimTransform; }
void CalculateInverseBindTransform(mat4x4 ParentBindTransform); //this functon is called once, (n the joints set up)
};
#endif // !JOINT_H_