-
Notifications
You must be signed in to change notification settings - Fork 0
/
SkeletalModel.h
executable file
·86 lines (65 loc) · 2.11 KB
/
SkeletalModel.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
74
75
76
77
78
79
80
81
82
83
84
85
86
#ifndef SKELETALMODEL_H
#define SKELETALMODEL_H
#ifdef WIN32
#include <windows.h>
#endif
#ifndef M_PI
#define M_PI 3.14159265358979f
#endif
#include <cstdlib>
#include <FL/gl.h>
#include <iostream>
#include <fstream>
#include <map>
#include <vector>
#include <sstream>
#include <vecmath.h>
#ifdef __APPLE__
# include <GLUT/glut.h>
#else
# include <GL/glut.h>
#endif
#include "tuple.h"
#include "Joint.h"
#include "Mesh.h"
#include "MatrixStack.h"
class SkeletalModel
{
public:
// Already-implemented utility functions that call the code you will write.
void load(const char *skeletonFile, const char *meshFile, const char *attachmentsFile);
void draw(Matrix4f cameraMatrix, bool drawSkeleton);
// Part 1: Understanding Hierarchical Modeling
// 1.1. Implement method to load a skeleton.
// This method should compute m_rootJoint and populate m_joints.
void loadSkeleton( const char* filename );
// 1.1. Implement this method with a recursive helper to draw a sphere at each joint.
void drawJoints( );
// 1.2. Implement this method a recursive helper to draw a box between each pair of joints
void drawSkeleton( );
// 1.3. Implement this method to handle changes to your skeleton given
// changes in the slider values
void setJointTransform( int jointIndex, float rX, float rY, float rZ );
// Part 2: Skeletal Subspace Deformation
// 2.3. Implement SSD
// 2.3.1. Implement this method to compute a per-joint transform from
// world-space to joint space in the BIND POSE.
void computeBindWorldToJointTransforms();
// 2.3.2. Implement this method to compute a per-joint transform from
// joint space to world space in the CURRENT POSE.
void updateCurrentJointToWorldTransforms();
// 2.3.2. This is the core of SSD.
// Implement this method to update the vertices of the mesh
// given the current state of the skeleton.
// You will need both the bind pose world --> joint transforms.
// and the current joint --> world transforms.
void updateMesh();
private:
// pointer to the root joint
Joint* m_rootJoint;
// the list of joints.
std::vector< Joint* > m_joints;
Mesh m_mesh;
MatrixStack m_matrixStack;
};
#endif