JunkBox_Win_Lib 1.5.3
Loading...
Searching...
No Matches
NiVMDTool.cpp
Go to the documentation of this file.
1
2#include "NiVMDTool.h"
3
4
5using namespace jbxl;
6using namespace jbxwl;
7
8
9static std::string _VMDJointName[] = // VMD_JOINT_NUM
10{
11 // SJIS
12 "全ての親", "センター",
13 "下半身", "上半身", "上半身2", "首", "頭", "頭先",
14 "両目", "左目", "右目", "左胸", "右胸",
15
16 "左肩", "左腕", "左腕捩", "左ひじ", "左手捩", "左手首", "左手先",
17 "右肩", "右腕", "右腕捩", "右ひじ", "右手捩", "右手首", "右手先",
18
19
20 "左足", "左ひざ", "左足IK", "左足首", "左つま先", "左つま先IK",
21 "右足", "右ひざ", "右足IK", "右足首", "右つま先", "右つま先IK"
22};
23
24
25//
26static std::string _VMDJointName_eng[] = // VMD_JOINT_NUM
27{
28 "parent", "center",
29 "lower body", "upper body", "upper body2", "neck", "head", "skull",
30 "eyes", "eye_L", "eye_R", "bust_L", "bust_R",
31
32 "shoulder_L", "arm_L", "arm twist_L", "elbow_L", "wrist twist_L", "wrist_L", "c wrist l",
33 "shoulder_R", "arm_R", "arm twist_R", "elbow_R", "wrist twist_R", "wrist_R", "c wrist r",
34
35 "leg_L", "knee_L", "leg_IK_L", "ankle_L", "toe_L", "toe_IK_L",
36 "leg_R", "knee_R", "leg_IK_R", "ankle_R", "toe_R", "toe_IK_R"
37};
38
39
40
46std::string jbxwl::VMDJointName(int n)
47{
48 std::string str = "";
49
50 if (n>=0 && n<VMD_JOINT_NUM) {
51 str = _VMDJointName[n];
52 }
53
54 return str;
55}
56
57
58
64int jbxwl::VMDJointNum(char* name)
65{
66 for (int i=0; i<VMD_JOINT_NUM; i++) {
67 if (!strcmp(name, _VMDJointName[i].c_str()) || !strcmp(name, _VMDJointName_eng[i].c_str())) {
68 return i;
69 }
70 }
71 return -1;
72}
73
74
75
76/*
77VMD_PARENT ( 0) => none
78VMD_CENTER ( 1) => NI_PELVIS ( 0)
79VMD_LOWER ( 2) => NI_WAIST ( 1)
80VMD_UPPER ( 3) => NI_TORSO ( 2)
81VMD_UPPER2 ( 4) => NI_CHEST ( 3)
82VMD_NECK ( 5) => NI_NECK ( 4)
83VMD_HEAD ( 6) => NI_HEAD ( 5)
84VMD_SKULL ( 7) => NI_SKULL ( 6)
85
86VMD_EYES ( 8) => none
87VMD_L_EYE ( 9) => NI_L_EYE ( 7)
88VMD_R_EYE (10) => NI_R_EYE ( 8)
89VMD_L_BUST (11) => NI_L_BUST ( 9)
90VMD_R_BUST (12) => NI_R_BUST (10)
91
92VMD_L_SHLDR (13) => NI_L_COLLAR(11)
93VMD_L_ARM (14) => NI_L_SHLDR (12)
94VMD_L_ARM_TW (15) => none
95VMD_L_ELBOW (16) => NI_R_ELBOW (13)
96VMD_L_WRIST_TW (17) => none
97VMD_L_WRIST (18) => NI_L_WRIST (14)
98VMD_L_HAND (19) => NI_R_HAND (15)
99
100VMD_R_SHLDR (20) => NI_R_COLLAR(17)
101VMD_R_ARM (21) => NI_R_SHLDR (18)
102VMD_R_ARM_TW (22) => none
103VMD_R_ELBOW (23) => NI_R_ELBOW (19)
104VMD_R_WRIST_TW (24) => none
105VMD_R_WRIST (25) => NI_R_WRIST (20)
106VMD_R_HAND (26) => NI_R_HAND (21)
107
108VMD_L_HIP (27) => NI_L_HIP (23)
109VMD_L_KNEE (28) => NI_L_KNEE (24)
110VMD_L_ANKLE_IK (29) => NI_L_ANKLE (25)
111VMD_L_ANKLE (30) => NI_L_FOOT (26)
112VMD_L_TOE (31) => NI_L_TOE (27)
113VMD_L_TOE_IK (32) => none
114
115VMD_R_HIP (33) => NI_R_HIP (28)
116VMD_R_KNEE (34) => NI_R_KNEE (29)
117VMD_R_ANKLE_IK (35) => NI_R_ANKLE (30)
118VMD_R_ANKLE (36) => NI_R_FOOT (31)
119VMD_R_TOE (37) => NI_R_TOE (32)
120VMD_R_TOE_IK (38) => none
121*/
122
123//
124// VMDのジョイント番号から,共通ジョイントの番号を得る
125//
126static int _VMD2NiJointNum[] = // VMD_JOINT_NUM (37)
127{
128 -1, 0,
129 1, 2, 3, 4, 5, 6,
130 -1, 7, 8, 9, 10,
131 11, 12, -1, 13, -1, 14, 15,
132 17, 18, -1, 19, -1, 20, 21,
133 23, 24, 25, 26, 27, -1,
134 28, 29, 30, 31, 32, -1
135};
136
137
138
143{
144 if (joint<0 || joint>=VMD_JOINT_NUM) return -1;
145
146 return _VMD2NiJointNum[joint];
147}
148
149
150
152// CNiVMDTool Class
153
155{
156 memset(&vmd_header, 0, sizeof(VMDFileHeader));
157
158 vmd_frames = NULL;
159 vmd_datnum = 0;
160 dmy_frames = NULL;
161 dmy_frmnum = 0;
163
165 A2TPose.setRotation(37.0/180.0*PI, 1.0, 0.0, 0.0, 1.0);
166
167 posVect = (Vector<double>*)malloc(sizeof(Vector<double>)*VMD_JOINT_NUM);
168 rotQuat = (Quaternion<double>*)malloc(sizeof(Quaternion<double>)*VMD_JOINT_NUM);
169}
170
171
172
174{
175 DEBUG_INFO("DESTRUCTOR: CNiVMDTool\n");
176
177 free_data();
178}
179
180
181
183{
185 if (vmd_frames!=NULL) ::free(vmd_frames);
186
187 vmd_frames = NULL;
188 vmd_datnum = 0;
189 dmy_frames = NULL;
190 dmy_frmnum = 0;
191
192 clear_data();
193}
194
195
196
201
202
203
204
206//
207
214{
215 if (fp==NULL) return FALSE;
216
217 clear_data();
218
219 vmd_datnum = 0;
220 vmd_header = readFileHeader(fp); // ヘッダ部
221 if (vmd_header.data_num==0) return FALSE;
222
223 vmd_frames = readJointsData(fp, vmd_header.data_num); // 全フレームのデータ
224 if (vmd_frames==NULL) return FALSE;
226
227 //
229 if (jointsData!=NULL) ::free(jointsData);
230 jointsData = (NiJointData*)malloc(sizeof(NiJointData)*joints_num);
231 if (jointsData==NULL) {
232 clear_data();
233 return FALSE;
234 }
236
237 if (posVect==NULL) posVect = (Vector<double>*)malloc(sizeof(Vector<double>)*VMD_JOINT_NUM);
238 if (rotQuat==NULL) rotQuat = (Quaternion<double>*)malloc(sizeof(Quaternion<double>)*VMD_JOINT_NUM);
239 if (posVect==NULL || rotQuat==NULL) {
240 clear_data();
241 return FALSE;
242 }
244
245 return TRUE;
246}
247
248
249
256{
257 VMDFileHeader fhd;
258
259 fread(fhd.header, 30, 1, fp);
260 fread(fhd.name, 20, 1, fp);
261 fread(&fhd.data_num, 4, 1, fp);
262
263 if (strcmp(VMD_FILE_HD_ID2, fhd.header)) {
264 fhd.data_num = 0;
265 }
266
267 return fhd;
268}
269
270
271
279{
280 VMDJointData frame;
281
282 fread(frame.name, 15, 1, fp);
283 fread(&frame.frm_num, 96, 1, fp); // 4 + 4x7 + 64
284
285 return frame;
286}
287
288
289
296VMDJointData* CNiVMDTool::readJointsData(FILE* fp, unsigned int& frmnum)
297{
298 VMDJointData* motion_data = (VMDJointData*)malloc(frmnum*sizeof(VMDJointData));
299 if (motion_data==NULL) return NULL;
300 memset(motion_data, 0, frmnum*sizeof(VMDJointData));
301
302 //
303 unsigned int num = 0;
304 while(num<frmnum) {
305 motion_data[num] = readJointData(fp);
306 if (feof(fp)) break;
307 num++;
308 }
309
310 frmnum = num;
311 if (frmnum==0) {
312 ::free(motion_data);
313 motion_data = NULL;
314 }
315
316 return motion_data;
317}
318
319
320
331{
333
335 if (framesData!=NULL) clear_data();
337 if (framesData==NULL) return NULL;
338
341
342 // ジョイント番号の書き換え
343 for (unsigned int i=0; i<frames_num; i++) {
344 //
345 for (int j=0; j<framesData[i].jnum; j++) {
346 int n = VMD2NiJointNum(framesData[i].jdat[j].joint);
347 framesData[i].jdat[j].joint = n;
348 }
349 }
350
351
354 if (dmy_frames==NULL) {
356 return framesData;
357 }
358
359 for (unsigned int i=0; i<dmy_frmnum; i++) {
361 dmy_frames[i].msec = (int)(i*(100.0/(rate_frame*3.0)));
362 }
363 if (rate_frame!=1.0) {
364 for (unsigned int i=0; i<frames_num; i++) {
365 framesData[i].frmn = (int)(framesData[i].frmn*rate_frame);
366 framesData[i].msec = (int)(framesData[i].msec/rate_frame);
367 }
368 }
369
373
374 return dmy_frames;
375}
376
377
378
388NiFrameData* CNiVMDTool::convert2FrameData(VMDJointData* motion_data, unsigned int datanum, unsigned int& framenum)
389{
390 framenum = 0;
391 if (motion_data==NULL || datanum<=0) return NULL;
392
393 // VMDのデータをフレーム番号でソート
394 VMDJointData swap_motion;
395 unsigned int k = datanum - 1;
396 while (k>0) {
397 unsigned int j = 0;
398 for (unsigned int i=0; i<k; i++) {
399 if (motion_data[i].frm_num>motion_data[i+1].frm_num) {
400 swap_motion = motion_data[i];
401 motion_data[i] = motion_data[i+1];
402 motion_data[i+1] = swap_motion;
403 j = i;
404 }
405 }
406 k = j;
407 }
408
409 // 一意的なフレーム数を数える
410 unsigned int uniq_frame = 1;
411
412 unsigned int frm_num = motion_data[0].frm_num;
413 for (unsigned int i=1; i<datanum; i++) {
414 if (frm_num!=motion_data[i].frm_num) {
415 uniq_frame++;
416 frm_num = motion_data[i].frm_num;
417 }
418 }
419
420 NiFrameData* ni_joints = makeFramesData((int)uniq_frame, joints_num, NULL);
421 if (ni_joints==NULL) return NULL;
422 framenum = uniq_frame;
423
424 // Joints
425 unsigned int datacnt = 0;
426 for (unsigned int i=0; i<uniq_frame; i++) {
427 frm_num = motion_data[datacnt].frm_num;
428 ni_joints[i].frmn = frm_num;
429 ni_joints[i].msec = (int)(frm_num*33.3333333333333); // msec
430 //
431 while (frm_num==motion_data[datacnt].frm_num) {
432 int joint = VMDJointNum(motion_data[datacnt].name);
433 if (joint>=0) {
434 NiJointData* jdat = &(ni_joints[i].jdat[joint]);
435 jdat->joint = joint;
436 jdat->index = i;
437 jdat->vect.x = -motion_data[datacnt].posz*(double)VMD_GRID_UNIT;
438 jdat->vect.y = motion_data[datacnt].posx*(double)VMD_GRID_UNIT;
439 jdat->vect.z = motion_data[datacnt].posy*(double)VMD_GRID_UNIT;
440 jdat->quat.x = motion_data[datacnt].qutz;
441 jdat->quat.y = -motion_data[datacnt].qutx;
442 jdat->quat.z = -motion_data[datacnt].quty;
443 jdat->quat.s = motion_data[datacnt].qutw;
444 if (jdat->quat.s<0.0) jdat->quat = - jdat->quat;
445 jdat->quat.normalize();
446
447 //
448 if (jdat->vect.x!=0.0 || jdat->vect.y!=0.0 || jdat->vect.z!=0.0) {
449 jdat->vect.c = 1.0;
450 }
451 if (jdat->quat.x!=0.0 || jdat->quat.y!=0.0 || jdat->quat.z!=0.0 || jdat->quat.s!=0.0) {
452 jdat->quat.c = 1.0;
453 }
454 }
455
456 datacnt++;
457 if (datacnt==datanum) break;
458 }
459 }
460
461 //
462 return ni_joints;
463}
464
465
466
473{
474 if (framesData==NULL || frames_num<=0) return;
475
476 if (posVect==NULL) posVect = (Vector<double>*)malloc(sizeof(Vector<double>)*VMD_JOINT_NUM);
477 if (rotQuat==NULL) rotQuat = (Quaternion<double>*)malloc(sizeof(Quaternion<double>)*VMD_JOINT_NUM);
478 if (posVect==NULL || rotQuat==NULL) return;
480
481 NiJointData prevJoint[VMD_JOINT_NUM]; // joints_num = VMD_JOINT_NUM
482 for (int j=0; j<VMD_JOINT_NUM; j++) {
483 prevJoint[j].joint = -1;
484 prevJoint[j].index = -1;
485 prevJoint[j].vect.init(-1.0);
486 prevJoint[j].quat.init(-1.0);
487 }
488
489 // 関節の変換
490 for (unsigned int i=0; i<frames_num; i++) {
491 //
492 NiJointData* jdata = framesData[i].jdat;
493
494 jdata[VMD_CENTER].vect.c = 1.0;
495 jdata[VMD_CENTER].quat.c = 1.0;
496
497 for (int j=0; j<framesData[i].jnum; j++) {
498 //
499 if (jdata[j].joint>=0) {
500 posVect[j] = jdata[j].vect;
501 rotQuat[j] = jdata[j].quat;
502 if (posVect[j].c<0.0) posVect[j] = prevJoint[j].vect;
503 if (rotQuat[j].c<0.0) rotQuat[j] = prevJoint[j].quat;
504 }
505 //
506 else {
507 posVect[j] = prevJoint[j].vect;
508 rotQuat[j] = prevJoint[j].quat;
509 }
510 }
511
513 calcJointIK(i); // IK
515
516 //
517 for (int j=0; j<framesData[i].jnum; j++) {
518 if (jdata[j].joint>=0) {
519 prevJoint[j] = jdata[j];
520 }
521 }
522
523 //
528
531
535 rotQuat[VMD_L_ARM] = rotQuat[VMD_L_ARM]*~A2TPose;
536
540
541 // 足首の回転は省略
542 rotQuat[VMD_L_ANKLE_IK].set(1.0, 0.0, 0.0, 0.0, 1.0);
543 rotQuat[VMD_R_ANKLE_IK].set(1.0, 0.0, 0.0, 0.0, 1.0);
544
545 //rotQuat[VMD_CENTER] = rotQuat[VMD_CENTER]*~rotQuat[VMD_PARENT];
546 //posVect[VMD_CENTER] = posVect[VMD_CENTER] + posVect[VMD_PARENT];
547
548 //
549 for (int j=0; j<framesData[i].jnum; j++) {
550 jdata[j].joint = prevJoint[j].joint;
551 jdata[j].index = prevJoint[j].index;
552 jdata[j].vect = posVect[j];
553 jdata[j].quat = rotQuat[j];
554 }
555 }
556
557 return;
558}
559
560
561
563{
564 // 軸
565 Vector<double> vect_Y(0.0, 1.0, 0.0, 1.0);
566 Vector<double> vect_Z(0.0, 0.0,-1.0, 1.0);
567 Vector<double> cnt_vect_Y = VectorRotation(vect_Y, rotQuat[VMD_CENTER]);
568 Vector<double> cnt_vect_Z = VectorRotation(vect_Z, rotQuat[VMD_CENTER]);
569
570 // 足の方向
571 Vector<double> l_leg_vect = VectorRotation(cnt_vect_Z, rotQuat[VMD_L_HIP]);
572 Vector<double> r_leg_vect = VectorRotation(cnt_vect_Z, rotQuat[VMD_R_HIP]);
573
574 // エフェクタ: センターからの初期相対位置
575 Vector<double> l_ank_vect = vect_Y*0.10 + vect_Z*0.83;
576 Vector<double> r_ank_vect = -vect_Y*0.10 + vect_Z*0.83;
577
578 // エフェクタ: 移動後のセンターからの相対位置
579 Vector<double> l_end_vect = cnt_vect_Y*0.10 + l_leg_vect*0.83;
580 Vector<double> r_end_vect = -cnt_vect_Y*0.10 + r_leg_vect*0.83;
581
582 // 到達目標
583 Vector<double> l_ik_vect = l_ank_vect + posVect[VMD_L_ANKLE_IK] - posVect[VMD_CENTER] - l_end_vect;
584 Vector<double> r_ik_vect = r_ank_vect + posVect[VMD_R_ANKLE_IK] - posVect[VMD_CENTER] - r_end_vect;
585
586 // 到達目標(ローカル座標系)
587 l_ik_vect = VectorRotation(l_ik_vect, ~rotQuat[VMD_CENTER]);
588 r_ik_vect = VectorRotation(r_ik_vect, ~rotQuat[VMD_CENTER]);
589
590 //
591 Vector<double> l_vect[3], r_vect[3];
592 Quaternion<double> l_quat[3], r_quat[3];
593
594 // 膝,腰の相対位置
595 l_vect[0].set(0.0, 0.0, 0.0);
596 r_vect[0].set(0.0, 0.0, 0.0);
597
598 l_vect[1] = -l_leg_vect*0.58;
599 r_vect[1] = -r_leg_vect*0.58;
600 l_vect[2] = -l_leg_vect*1.18;
601 r_vect[2] = -r_leg_vect*1.18;
602
603 // ローカル座標系
604 l_vect[1] = VectorRotation(l_vect[1], ~rotQuat[VMD_CENTER]);
605 r_vect[1] = VectorRotation(r_vect[1], ~rotQuat[VMD_CENTER]);
606 l_vect[2] = VectorRotation(l_vect[2], ~rotQuat[VMD_CENTER]);
607 r_vect[2] = VectorRotation(r_vect[2], ~rotQuat[VMD_CENTER]);
608
610 calcLegIK_CCD(l_vect, l_ik_vect, l_quat, 50);
611 calcLegIK_CCD(r_vect, r_ik_vect, r_quat, 50);
613
614 // HIP
615 if (rotQuat[VMD_L_HIP].c>0.0) rotQuat[VMD_L_HIP] = l_quat[2]*rotQuat[VMD_L_HIP];
616 else rotQuat[VMD_L_HIP] = l_quat[2];
617 if (rotQuat[VMD_R_HIP].c>0.0) rotQuat[VMD_R_HIP] = r_quat[2]*rotQuat[VMD_R_HIP];
618 else rotQuat[VMD_R_HIP] = r_quat[2];
619
622 framesData[fnum].jdat[VMD_L_HIP].index = fnum;
623 framesData[fnum].jdat[VMD_R_HIP].index = fnum;
624
625 // KNEE
626 rotQuat[VMD_L_KNEE] = l_quat[1];
627 rotQuat[VMD_R_KNEE] = r_quat[1];
628 //
629 double dot = vect_Y*rotQuat[VMD_L_KNEE].getVector();
630 if (dot>=0.0) {
632 framesData[fnum].jdat[VMD_L_KNEE].index = fnum;
633 }
634 else {
635 framesData[fnum].jdat[VMD_L_KNEE].joint = -1;
636 framesData[fnum].jdat[VMD_L_KNEE].index = -1;
637 }
638
639 dot = vect_Y*rotQuat[VMD_R_KNEE].getVector();
640 if (dot>=0.0) {
642 framesData[fnum].jdat[VMD_R_KNEE].index = fnum;
643 }
644 else {
645 framesData[fnum].jdat[VMD_R_KNEE].joint = -1;
646 framesData[fnum].jdat[VMD_R_KNEE].index = -1;
647 }
648
649 return;
650}
651
652
653
657void CNiVMDTool::calcLegIK_CCD(Vector<double>* vect, Vector<double> ik_vect, Quaternion<double>* quat, int rpmax)
658{
659 Vector<double> vect_Y(0.0, 1.0, 0.0, 1.0);
660 Vector<double> effect, target;
661 Quaternion<double> rot;
662
663 for (int j=0; j<3; j++) quat[j].init();
664
665 for (int i=0; i<rpmax; i++) {
666 //
667 int cnt = 0;
668 for (int j=1; j<3; j++) {
669 //
670 if (i==0 && j==1) {
671 rot.setRotation((double)PI_DIV2, vect_Y); // 最初にひざを曲げる
672 }
673 else {
674 effect = vect[0] - vect[j];
675 target = ik_vect - vect[j];
676 rot = V2VQuaternion(effect, target);
677 }
678
679 //
680 if (rot.c>0.0) {
681 rot.normalize();
682 if (rot.s<1.00-Zero_Eps) {
683 //if (rot.s<1.00) {
684 quat[j] = quat[j]*rot;
685 for (int k=0; k<j; k++) {
686 vect[k] = VectorRotation(vect[k]-vect[j], rot) + vect[j];
687 }
688 }
689 else cnt++;
690 }
691 else cnt++;
692 }
693 if (cnt==2) break;
694 }
695
696 return;
697}
698
699
700
714{
716
717 frmnum = (int)((double)frmnum*VMD_FARME_RATE/(double)fps);
718
719 //
720 for (int j=0; j<joints_num; j++) {
721 //
722 int n = framesData[0].jdat[j].joint;
723 if (n>=0) {
724 unsigned int st_index = 0;
725 unsigned int en_index = 0;
726
727 while (en_index<frames_num && framesData[en_index].frmn<frmnum) en_index++;
728 if (en_index==frames_num) break;
729
730 if (en_index==0 || (framesData[en_index].frmn==frmnum && en_index==framesData[en_index].jdat[j].index)) {
731 jointsData[j].vect = framesData[en_index].jdat[j].vect;
732 jointsData[j].quat = framesData[en_index].jdat[j].quat;
733 }
734 else {
735 st_index = framesData[en_index-1].jdat[j].index;
736 while (en_index<frames_num && en_index!=framesData[en_index].jdat[j].index) en_index++;
737
738 if (en_index==frames_num) {
739 jointsData[j].vect = framesData[st_index].jdat[j].vect;
740 jointsData[j].quat = framesData[st_index].jdat[j].quat;
741 }
742 else {
743 NiJointData st_joint = framesData[st_index].jdat[j];
744 NiJointData en_joint = framesData[en_index].jdat[j];
745 double tparam = ((double)(frmnum - framesData[st_index].frmn))/(framesData[en_index].frmn - framesData[st_index].frmn);
746 jointsData[j].vect = BSplineInterp4 (st_joint.vect, en_joint.vect, tparam);
747 jointsData[j].quat = SlerpQuaternion(st_joint.quat, en_joint.quat, tparam);
748 }
749 }
750
751 jointsData[j].joint = n;
752 jointsData[j].index = frmnum;
753 jointsData[j].vect.c = 1.0;
754 jointsData[j].quat.c = 1.0;
755 }
756 }
757
758 return jointsData;
759}
760
761
static std::string _VMDJointName_eng[]
Definition NiVMDTool.cpp:26
static int _VMD2NiJointNum[]
static std::string _VMDJointName[]
Definition NiVMDTool.cpp:9
#define VMD_L_KNEE
Definition NiVMDTool.h:50
#define VMD_R_HIP
Definition NiVMDTool.h:56
#define VMD_L_HIP
Definition NiVMDTool.h:49
#define VMD_R_ANKLE_IK
Definition NiVMDTool.h:58
#define VMD_L_WRIST
Definition NiVMDTool.h:38
#define VMD_JOINT_NUM
Definition NiVMDTool.h:11
#define VMD_L_ARM
Definition NiVMDTool.h:34
#define VMD_L_ELBOW
Definition NiVMDTool.h:36
#define VMD_R_KNEE
Definition NiVMDTool.h:57
#define VMD_L_ANKLE_IK
Definition NiVMDTool.h:51
#define VMD_R_EYE
Definition NiVMDTool.h:29
#define VMD_L_EYE
Definition NiVMDTool.h:28
#define VMD_L_ARM_TW
Definition NiVMDTool.h:35
#define VMD_FILE_HD_ID2
Definition NiVMDTool.h:9
#define VMD_L_WRIST_TW
Definition NiVMDTool.h:37
#define VMD_R_ELBOW
Definition NiVMDTool.h:44
#define VMD_FARME_RATE
Definition NiVMDTool.h:14
#define VMD_CENTER
Definition NiVMDTool.h:19
#define VMD_R_WRIST_TW
Definition NiVMDTool.h:45
#define VMD_R_WRIST
Definition NiVMDTool.h:46
#define VMD_GRID_UNIT
Definition NiVMDTool.h:12
#define VMD_R_ARM_TW
Definition NiVMDTool.h:43
#define VMD_EYES
Definition NiVMDTool.h:27
#define VMD_R_ARM
Definition NiVMDTool.h:42
NiJointData * jointsData
void clearVectorData(int jnum)
void clearJointsData(int jnum)
Vector< double > * posVect
unsigned int frames_num
NiFrameData * framesData
Quaternion< double > * rotQuat
VMDJointData readJointData(FILE *fp)
Quaternion< double > A2TPose
Definition NiVMDTool.h:129
unsigned int vmd_datnum
Definition NiVMDTool.h:135
VMDFileHeader readFileHeader(FILE *fp)
void calcJointIK(int fnum)
virtual BOOL readFile(FILE *fp)
virtual NiJointData * getJointsData(int frmnum, int fps)
NiFrameData * dmy_frames
Definition NiVMDTool.h:138
void calcLegIK_CCD(Vector< double > *vect, Vector< double > ik, Quaternion< double > *quat, int rpmax)
VMDFileHeader vmd_header
Definition NiVMDTool.h:133
unsigned int dmy_frmnum
Definition NiVMDTool.h:139
void clear_data(void)
NiFrameData * convert2FrameData(VMDJointData *motion_data, unsigned int datnum, unsigned int &frmnum)
void calcJointRotation(void)
void free_data(void)
virtual ~CNiVMDTool(void)
VMDJointData * readJointsData(FILE *fp, unsigned int &frmnum)
virtual NiFrameData * getFramesData(void)
VMDJointData * vmd_frames
Definition NiVMDTool.h:134
NiFrameData * makeFramesData(int frame, int joint_num, int *frame_num)
std::string VMDJointName(int n)
Definition NiVMDTool.cpp:46
int VMD2NiJointNum(int joint)
void freeFramesData(NiFrameData *frmdata, int frm_num)
int VMDJointNum(char *name)
Definition NiVMDTool.cpp:64
NiJointData * jdat
Quaternion< double > quat
Vector< double > vect
unsigned int data_num
Definition NiVMDTool.h:74
char name[20]
Definition NiVMDTool.h:73
char header[30]
Definition NiVMDTool.h:72
double qutz
Definition NiVMDTool.h:89
char name[15]
Definition NiVMDTool.h:82
unsigned long frm_num
Definition NiVMDTool.h:83
double posx
Definition NiVMDTool.h:84
double posz
Definition NiVMDTool.h:86
double posy
Definition NiVMDTool.h:85
double quty
Definition NiVMDTool.h:88
double qutx
Definition NiVMDTool.h:87
double qutw
Definition NiVMDTool.h:90