-
Notifications
You must be signed in to change notification settings - Fork 2
/
body.hpp
347 lines (255 loc) · 6.01 KB
/
body.hpp
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
#include "basics.hpp"
#include <fstream>
#define pelvis 1
#define torso 2
#define head 3
#define right_upper_arm 4
#define right_lower_arm 5
#define right_hand 6
#define left_upper_arm 7
#define left_lower_arm 8
#define left_hand 9
#define right_thigh 10
#define right_leg 11
#define right_foot 12
#define left_thigh 13
#define left_leg 14
#define left_foot 15
#define rs_joint 16
#define ls_joint 17
class body {
private:
double pos_x;
double pos_y;
double pos_z;
double rotate_x_angle;
double rotate_y_angle;
double rotate_z_angle;
double ortho_y_angle;
double elbows_y_offset;
double ip_pos_x;
double ip_pos_y;
double ip_pos_z;
double ip_rotate_x_angle;
double ip_rotate_y_angle;
double ip_rotate_z_angle;
double ip_ortho_y_angle;
double ip_elbows_y_offset;
/* Angle Limits */
static double shoulder_x_min;
static double shoulder_x_max;
static double shoulder_y_min;
static double shoulder_y_max;
static double shoulder_z_min;
static double shoulder_z_max;
static double waist_x_min;
static double waist_x_max;
static double waist_y_min;
static double waist_y_max;
static double waist_z_min;
static double waist_z_max;
static double neck_x_min;
static double neck_x_max;
static double neck_y_min;
static double neck_y_max;
static double neck_z_min;
static double neck_z_max;
static double ankle_x_min;
static double ankle_x_max;
static double ankle_y_min;
static double ankle_y_max;
static double wrist_x_min;
static double wrist_x_max;
static double wrist_z_min;
static double wrist_z_max;
static double hip_x_min;
static double hip_x_max;
static double hip_y_min;
static double hip_y_max;
static double hip_z_min;
static double hip_z_max;
static double elbow_x_min;
static double elbow_x_max;
static double knee_x_min;
static double knee_x_max;
/* Current Angles */
double right_shoulder_x;
double right_shoulder_y;
double right_shoulder_z;
double left_shoulder_x;
double left_shoulder_y;
double left_shoulder_z;
double waist_x;
double waist_y;
double waist_z;
double neck_x;
double neck_y;
double neck_z;
double right_ankle_x;
double right_ankle_y;
double right_wrist_x;
double right_wrist_z;
double left_ankle_x;
double left_ankle_y;
double left_wrist_x;
double left_wrist_z;
double right_hip_x;
double right_hip_y;
double right_hip_z;
double left_hip_x;
double left_hip_y;
double left_hip_z;
double right_elbow_x;
double left_elbow_x;
double right_knee_x;
double left_knee_x;
double rs_joint_x;
double ls_joint_x;
double ip_right_shoulder_x;
double ip_right_shoulder_y;
double ip_right_shoulder_z;
double ip_left_shoulder_x;
double ip_left_shoulder_y;
double ip_left_shoulder_z;
double ip_waist_x;
double ip_waist_y;
double ip_waist_z;
double ip_neck_x;
double ip_neck_y;
double ip_neck_z;
double ip_right_ankle_x;
double ip_right_ankle_y;
double ip_right_wrist_x;
double ip_right_wrist_z;
double ip_left_ankle_x;
double ip_left_ankle_y;
double ip_left_wrist_x;
double ip_left_wrist_z;
double ip_right_hip_x;
double ip_right_hip_y;
double ip_right_hip_z;
double ip_left_hip_x;
double ip_left_hip_y;
double ip_left_hip_z;
double ip_right_elbow_x;
double ip_left_elbow_x;
double ip_right_knee_x;
double ip_left_knee_x;
double ip_rs_joint_x;
double ip_ls_joint_x;
/* Display Lists are created here */
void init_right_hand();
void init_right_lower_arm();
void init_right_upper_arm();
void init_left_hand();
void init_left_lower_arm();
void init_left_upper_arm();
void init_head();
void init_torso();
void init_right_foot();
void init_right_leg();
void init_right_thigh();
void init_left_foot();
void init_left_leg();
void init_left_thigh();
void init_pelvis();
void init_joints();
/* Does the appropriate transformations and calls the display lists */
public:
body();
void render();
/* Change the angles on key presses */
void move_right_shoulder_x(double t);
void move_right_shoulder_y(double t);
void move_right_shoulder_z(double t);
void move_left_shoulder_x(double t);
void move_left_shoulder_y(double t);
void move_left_shoulder_z(double t);
void move_waist_x(double t);
void move_waist_y(double t);
void move_waist_z(double t);
void move_neck_x(double t);
void move_neck_y(double t);
void move_neck_z(double t);
void move_right_ankle_x(double t);
void move_right_ankle_y(double t);
void move_right_wrist_x(double t);
void move_right_wrist_z(double t);
void move_left_ankle_x(double t);
void move_left_ankle_y(double t);
void move_left_wrist_x(double t);
void move_left_wrist_z(double t);
void move_left_hip_x(double t);
void move_left_hip_y(double t);
void move_left_hip_z(double t);
void move_right_hip_x(double t);
void move_right_hip_y(double t);
void move_right_hip_z(double t);
void move_right_elbow_x(double t);
void move_left_elbow_x(double t);
void move_right_knee_x(double t);
void move_left_knee_x(double t);
void rotate_x(double t);
void rotate_y(double t);
void rotate_z(double t);
void move_camera_r(double t);
void move_camera_t(double t);
void move_camera_p(double p);
void move(double t, double turn);
void move_x(double t);
void move_y(double t);
void rotate_y_ortho(double t);
bool transformed;
void transform();
void revert();
bool transforming;
int count_revert;
int count_transform;
int count_elbows_in;
int count_elbows_out;
int camera;
int ip_camera;
double dist;
double turn;
double wheel_rotate_angle;
double lookat_x;
double lookat_y;
double lookat_z;
bool headlight;
bool day;
bool moon_toggle;
double ip_turn;
double ip_wheel_rotate_angle;
double ip_lookat_x;
double ip_lookat_y;
double ip_lookat_z;
bool ip_headlight;
bool ip_day;
bool ip_moon_toggle;
double tree_x[100];
double tree_z[100];
bool tree_standing[100];
bool ip_tree_standing[100];
double tree_fall_angle[100];
double tree_y_angle[100];
/* Camera */
double camera_r;
double camera_t;
double camera_p;
double ip_camera_r;
double ip_camera_t;
double ip_camera_p;
bool camera_free;
bool ip_camera_free;
int frames;
int ip_frames;
void keyframe();
std::fstream keyfile;
bool playback;
bool terminate;
void playback_init();
void readframe();
void interpolate();
void linear_interpolate(double &, double &);
void angular_interpolate(double &, double &);
};