24 DEBUG_INFO(
"DESTRUCTOR: CNiJTextTool\n");
52 if (fp==NULL)
return FALSE;
56 Buffer buf = make_Buffer(LDATA);
59 fgets_Buffer(&buf, fp);
67 fgets_Buffer(&buf, fp);
69 if (buf.buf[0]>=
'0' && buf.buf[0]<=
'9') frames++;
70 fgets_Buffer(&buf, fp);
79 int* frame_msec = (
int*)malloc(
frames_num*
sizeof(
int));
82 fseek(fp, 0, SEEK_SET);
83 fgets_Buffer(&buf, fp);
85 while (buf.buf[0]<
'0' || buf.buf[0]>
'9') fgets_Buffer(&buf, fp);
89 frame_msec[i] = atoi((
char*)buf.buf);
92 fgets_Buffer(&buf, fp);
93 while (!feof(fp) && (buf.buf[0]<
'0' || buf.buf[0]>
'9')) {
94 if (buf.buf[0]==
' ') jnum++;
95 fgets_Buffer(&buf, fp);
97 joints = Max(joints, jnum);
134 fseek(fp, 0, SEEK_SET);
137 memset(jname, 0, L_ID);
140 fgets_Buffer(&buf, fp);
144 while (buf.buf[0]<
'0' || buf.buf[0]>
'9') fgets_Buffer(&buf, fp);
147 if (i==0) prvms = nowms;
148 int msec = nowms - prvms;
149 if (msec<0) msec += 60000;
158 double qx, qy, qz, qs, th;
164 fgets_Buffer(&buf, fp);
165 while (buf.buf[0]!=
' ') {
166 if (buf.buf[0]>=
'0' || buf.buf[0]<=
'9') {
170 fgets_Buffer(&buf, fp);
182 sscanf((
char*)buf.buf,
"%s %lf %lf %lf %lf %lf %lf %lf %lf", jname, &px, &py, &pz, &qx, &qy, &qz, &qs, &th);
184 jdat[j].
vect.set(px, py, pz);
185 jdat[j].
quat.set(qs, qx, qy, qz);
206 if (fp==NULL)
return;
209 fprintf(fp,
"%d\n", msec);
309 if (frmnum<0)
return NULL;
311 if (fps<=0) fps = 30;
312 int msec = (int)(1000./fps*frmnum);
333 if (jdat1[j].joint>=0) {
335 if (jdat1[j].joint==jdat2[k].joint) {
338 jointsData[j].
vect = BSplineInterp4 (jdat1[j].vect, jdat2[k].vect, t);
339 jointsData[j].
quat = SlerpQuaternion(jdat1[j].quat, jdat2[k].quat, t);
void writeCurrentData(FILE *fp, unsigned short msec)
virtual BOOL readFile(FILE *fp)
virtual NiJointData * getJointsData(int frmnum, int fps)
virtual ~CNiJTextTool(void)
void setRotQuat(Quaternion< double > *rot, NiSDK_Lib lib, BOOL mirror)
void setPosVect(Vector< double > *pos, NiSDK_Lib lib, BOOL mirror)
void setJntAngl(double *agl, NiSDK_Lib lib, BOOL mirror)
NiFrameData * makeFramesData(int frame, int joint_num, int *frame_num)
std::string NiJointName(int n)
int NiSDKMirrorJointNum(int joint, NiSDK_Lib lib)
int NiJointNum(char *name)
Quaternion< double > quat