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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
|
#ifndef _SKELETON_H_
#define _SKELETON_H_
/**> HEADER FILES <**/
#include <GL/gl.h>
#include <AL/al.h>
#include "Quaternions.h"
#include "Constants.h"
#include "Files.h"
#include "Models.h"
#include "Camera.h"
#define boneconnect 0
#define constraint 1
#define muscle 2
//head, neck, left shoulder, left elbow, left wrist, left hand
//right shoulder, right elbow, right wrist, right hand,
//middle, left hip, right hip,groin
//left knee,left ankle, left foot, right knee, right ankle, right foort
#define head 1
#define neck 2
#define leftshoulder 3
#define leftelbow 4
#define leftwrist 5
#define lefthand 6
#define rightshoulder 7
#define rightelbow 8
#define rightwrist 9
#define righthand 10
#define abdomen 11
#define lefthip 12
#define righthip 13
#define groin 14
#define leftknee 15
#define leftankle 16
#define leftfoot 17
#define rightknee 18
#define rightankle 19
#define rightfoot 20
class Joint
{
public:
XYZ position;
XYZ oldposition;
XYZ realoldposition;
XYZ velocity;
XYZ offset;
float blurred;
float length;
float mass;
bool lower;
bool hasparent;
bool locked;
int modelnum;
bool visible;
bool existing;
Joint* parent;
int label;
int hasgun;
float rotate1,rotate2,rotate3;
void DoConstraint();
};
class Muscle
{
public:
float length;
float targetlength;
Joint* parent1;
Joint* parent2;
float maxlength;
float minlength;
int type;
bool visible;
void DoConstraint(int broken);
float rotate1,rotate2,rotate3;
float strength;
};
class Animation
{
public:
Files files;
int numframes;
bool canbeoverridden;
bool ismodified[max_joints][max_frames];
XYZ position[max_joints][max_frames];
float twist[max_joints][max_frames];
float twist2[max_joints][max_frames];
float speed[max_frames];
float gunrotation[max_frames];
bool onground[max_joints][max_frames];
XYZ forward[max_frames];
float rotate1[max_joints][max_frames],rotate2[max_joints][max_frames],rotate3[max_joints][max_frames];
float mrotate1[max_joints][max_frames],mrotate2[max_joints][max_frames],mrotate3[max_joints][max_frames];
void Load(char *fileName);
void Load(char *fileName,float rotate);
};
class Skeleton
{
public:
int num_joints;
Joint joints[max_joints];
int jointlabels[max_joints];
int num_muscles;
Muscle muscles[max_muscles];
int selected;
int forwardjoints[3];
XYZ forward;
int lowforwardjoints[3];
XYZ lowforward;
int broken;
bool offset;
XYZ specialforward[5];
bool free;
Files files;
void DoConstraints();
void DoConstraints(Model *collide, XYZ *move, float rotation);
void DoGravity();
void DoBalance();
void MusclesSet();
void Draw(int muscleview);
void AddJoint(float x, float y, float z, int which);
void SetJoint(float x, float y, float z, int which, int whichjoint);
void DeleteJoint(int whichjoint);
void AddMuscle(int attach1,int attach2,float maxlength,float minlength,int type);
void DeleteMuscle(int whichmuscle);
void FindRotationJoint(int which);
void FindRotationMuscle(int which);
void Load(char *fileName);
};
#endif
|