-
Notifications
You must be signed in to change notification settings - Fork 0
/
BVH.h
62 lines (46 loc) · 945 Bytes
/
BVH.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
#pragma once
#include <iostream>
#include <fstream>
#include <vector>
#include "SceneGraph.h"
enum
{
BVH_H_LOAD_ERROR = 0,
BVH_H_LOAD_FINE,
BVH_M_LOAD_ERROR,
BVH_M_LOAD_FINE,
};
struct Joint
{
unsigned int ID;
char* name;
Node* node;
int numChannels;
std::vector<glm::vec3> positionChanges;
std::vector<glm::vec3> rotationChanges;
glm::mat4 objSpaceAtBind;
Joint *parent;
};
class BVH
{
public:
BVH();
BVH(char* filePath);
~BVH();
void LoadFile(char* filePath);
int BuildSceneGraph(Node *parent);
int BuildMotionData(void);
//////////
//GETTERS
//////////
inline unsigned int GetNumFrames(void){ return numFrames; }
inline float GetFrameTime(void){ return frameTime; }
inline Node* GetRootNode(void){ return rootNode; }
inline std::vector<Joint> GetNodeTree(void){ return nodeTree; }
private:
char* filePath;
Node *rootNode;
std::vector<Joint> nodeTree;
unsigned int numFrames;
float frameTime;
};