JunkBox_Win_Lib 1.5.3
Loading...
Searching...
No Matches
NiFileTool.h
Go to the documentation of this file.
1#pragma once
2
3
4#include "WinTools.h"
5
6#include "NiJTextTool.h"
7#include "NiBVHTool.h"
8#include "NiVMDTool.h"
9
10
12// Kinect, Xtion 以外のファイルI/O のデバイスを扱う基本クラス
13//
14// JText, BVH, VMD
15//
16
17namespace jbxwl {
18
19using namespace jbxl;
20
21
23{
24public:
27
28 virtual ~CNiFileTool(void);
29
30 void free_data(void);
31 void clear_data(void);
32
33private:
35 BOOL m_enable_wfile; // 一時ファイルに書き込み可能
36 FILE* m_wfp;
37 FILE* m_rfp;
38
39protected:
40 void init(NiSDK_Lib lib);
41 void init_data(void);
42
43 BOOL open_wfile(LPCTSTR fname, BOOL force);
44 BOOL open_rfile(LPCTSTR fname);
45 void close_wfile(void);
46 void close_rfile(void);
47
48 void write_header(FILE* fp=NULL);
49
50public:
51 // Frame Data
54
57
59 unsigned short lap_timer;
60 double time_scale;
61
64
65public:
69
70public:
72
73 // Joints Text
74 int readJTextFile(LPCTSTR fname);
75 BOOL writeJTextData(FILE* fp, Vector<double>* pos, Quaternion<double>* rot, double* agl, BOOL mrr, NiSDK_Lib lib=NiSDK_Default);
76
77 BOOL saveJTextfromFile(LPCTSTR tempf, LPCTSTR fname, BOOL force);
78 BOOL writeTempJText(Vector<double>* pos, Quaternion<double>* rot, double* agl, BOOL mrr, NiSDK_Lib lib=NiSDK_Default);
79
80 // BVH
81 int readBVHFile(LPCTSTR fname);
82 BOOL saveBVHfromFile(LPCTSTR tempf, LPCTSTR fname, BVHSaveParam param);
83 BOOL writeBVHFile(LPCTSTR fname, BVHSaveParam param);
84
85 // VMD
86 int readVMDFile(LPCTSTR fname);
87 BOOL saveVMDfromFile(LPCTSTR tempf, LPCTSTR fname);
88
89public:
90 // Frame Data
91 void clearFrameData(void);
92
93 BOOL startFrame(int start=0);
94 BOOL nextFrame(BOOL next=TRUE);
95 void setFrame(int frame);
96 BOOL resetFrame(void) { return startFrame();}
97
98public:
99 //
100 virtual void Vector2Quaternion(Vector<double>* vt, Quaternion<double>* qt) {}
101
102 // Joints
103 void clearStartPosition(void) { startPos.init(1.0);}
104 void clearJointsData(void);
105
106 void getJointsDataSeq(BOOL mirror, int frame=-1);
107
108
109 Vector<double> startPos;
110 Vector<double> currentPos;
111
113 Quaternion<double> rotQuat[NI_TOTAL_JOINT_NUM];
114};
115
116
117} // namespace
118
#define NI_TOTAL_JOINT_NUM
CBaseFrameTool * frameTool
Definition NiFileTool.h:71
void init(NiSDK_Lib lib)
virtual ~CNiFileTool(void)
void setFrame(int frame)
CNiFileTool(NiSDK_Lib lib)
Definition NiFileTool.h:26
CNiVMDTool * VMD_Tool
Definition NiFileTool.h:67
int readBVHFile(LPCTSTR fname)
BOOL writeTempJText(Vector< double > *pos, Quaternion< double > *rot, double *agl, BOOL mrr, NiSDK_Lib lib=NiSDK_Default)
Vector< double > posVect[NI_TOTAL_JOINT_NUM]
Definition NiFileTool.h:112
void write_header(FILE *fp=NULL)
unsigned short lap_timer
Definition NiFileTool.h:59
BOOL saveBVHfromFile(LPCTSTR tempf, LPCTSTR fname, BVHSaveParam param)
void clearStartPosition(void)
Definition NiFileTool.h:103
BOOL startFrame(int start=0)
BOOL nextFrame(BOOL next=TRUE)
Vector< double > startPos
Definition NiFileTool.h:109
Quaternion< double > rotQuat[NI_TOTAL_JOINT_NUM]
Definition NiFileTool.h:113
int readVMDFile(LPCTSTR fname)
virtual void Vector2Quaternion(Vector< double > *vt, Quaternion< double > *qt)
Definition NiFileTool.h:100
BOOL writeJTextData(FILE *fp, Vector< double > *pos, Quaternion< double > *rot, double *agl, BOOL mrr, NiSDK_Lib lib=NiSDK_Default)
void clearJointsData(void)
BOOL open_wfile(LPCTSTR fname, BOOL force)
void clear_data(void)
void clearFrameData(void)
void free_data(void)
BOOL open_rfile(LPCTSTR fname)
CNiJTextTool * JTXT_Tool
Definition NiFileTool.h:66
void close_rfile(void)
void init_data(void)
CNiBVHTool * BVH_Tool
Definition NiFileTool.h:68
void close_wfile(void)
Vector< double > currentPos
Definition NiFileTool.h:110
void getJointsDataSeq(BOOL mirror, int frame=-1)
BOOL saveVMDfromFile(LPCTSTR tempf, LPCTSTR fname)
BOOL writeBVHFile(LPCTSTR fname, BVHSaveParam param)
BOOL saveJTextfromFile(LPCTSTR tempf, LPCTSTR fname, BOOL force)
int readJTextFile(LPCTSTR fname)
NiFrameData * frames_data
Definition NiFileTool.h:55
BOOL resetFrame(void)
Definition NiFileTool.h:96
NiSDK_Lib
Definition NiToolWin.h:35
@ NiSDK_Default
Definition NiToolWin.h:36