JunkBox_Win_Lib 1.5.3
|
#include <NiVMDTool.h>
Public Member Functions | |
CNiVMDTool (void) | |
virtual | ~CNiVMDTool (void) |
void | free_data (void) |
void | clear_data (void) |
virtual unsigned int | getFramesNumber (void) |
virtual NiFrameData * | getFramesData (void) |
virtual NiJointData * | getJointsData (int frmnum, int fps) |
virtual BOOL | readFile (FILE *fp) |
![]() | |
CBaseFrameTool (void) | |
virtual | ~CBaseFrameTool (void) |
virtual int | getJointsNumber (void) |
virtual int | getPlayBackTime (void) |
virtual int | getPlayBackFPS (void) |
virtual BOOL | writeFile (FILE *fp) |
Private Member Functions | |
VMDFileHeader | readFileHeader (FILE *fp) |
VMDJointData | readJointData (FILE *fp) |
VMDJointData * | readJointsData (FILE *fp, unsigned int &frmnum) |
NiFrameData * | convert2FrameData (VMDJointData *motion_data, unsigned int datnum, unsigned int &frmnum) |
void | calcJointRotation (void) |
void | calcJointIK (int fnum) |
void | calcLegIK_CCD (Vector< double > *vect, Vector< double > ik, Quaternion< double > *quat, int rpmax) |
Private Attributes | |
Quaternion< double > | A2TPose |
double | rate_frame |
VMDFileHeader | vmd_header |
VMDJointData * | vmd_frames |
unsigned int | vmd_datnum |
NiFrameData * | dmy_frames |
unsigned int | dmy_frmnum |
Additional Inherited Members | |
![]() | |
void | init_data (void) |
void | free_data (void) |
void | clear_data (void) |
void | clearJointsData (int jnum) |
void | clearVectorData (int jnum) |
![]() | |
unsigned int | frames_num |
int | joints_num |
int | start_time |
int | stop_time |
int | exec_time |
NiFrameData * | framesData |
NiJointData * | jointsData |
Vector< double > * | posVect |
Quaternion< double > * | rotQuat |
Definition at line 110 of file NiVMDTool.h.
CNiVMDTool | ( | void | ) |
Definition at line 154 of file NiVMDTool.cpp.
References CNiVMDTool::A2TPose, CNiVMDTool::dmy_frames, CNiVMDTool::dmy_frmnum, CBaseFrameTool::joints_num, CBaseFrameTool::posVect, CNiVMDTool::rate_frame, CBaseFrameTool::rotQuat, CNiVMDTool::vmd_datnum, VMD_FARME_RATE, CNiVMDTool::vmd_frames, CNiVMDTool::vmd_header, and VMD_JOINT_NUM.
|
virtual |
Definition at line 173 of file NiVMDTool.cpp.
References CNiVMDTool::free_data().
|
private |
Definition at line 562 of file NiVMDTool.cpp.
References CNiVMDTool::calcLegIK_CCD(), CBaseFrameTool::framesData, NiJointData::index, NiFrameData::jdat, NiJointData::joint, CBaseFrameTool::posVect, CBaseFrameTool::rotQuat, VMD_CENTER, VMD_L_ANKLE_IK, VMD_L_HIP, VMD_L_KNEE, VMD_R_ANKLE_IK, VMD_R_HIP, and VMD_R_KNEE.
Referenced by CNiVMDTool::calcJointRotation().
|
private |
void CNiVMDTool::calcJointRotation(void)
全ジョイントのクオータニオンを計算し直す.
Definition at line 472 of file NiVMDTool.cpp.
References CNiVMDTool::A2TPose, CNiVMDTool::calcJointIK(), CBaseFrameTool::clearVectorData(), CBaseFrameTool::frames_num, CBaseFrameTool::framesData, NiJointData::index, NiFrameData::jdat, NiFrameData::jnum, NiJointData::joint, CBaseFrameTool::posVect, NiJointData::quat, CBaseFrameTool::rotQuat, NiJointData::vect, VMD_CENTER, VMD_EYES, VMD_JOINT_NUM, VMD_L_ANKLE_IK, VMD_L_ARM, VMD_L_ARM_TW, VMD_L_ELBOW, VMD_L_EYE, VMD_L_WRIST, VMD_L_WRIST_TW, VMD_R_ANKLE_IK, VMD_R_ARM, VMD_R_ARM_TW, VMD_R_ELBOW, VMD_R_EYE, VMD_R_WRIST, and VMD_R_WRIST_TW.
Referenced by CNiVMDTool::getFramesData().
|
private |
HIP(2) -> KNEE(1) -> ANKLE(0) の IK をCCDで解く.
Definition at line 657 of file NiVMDTool.cpp.
Referenced by CNiVMDTool::calcJointIK().
void clear_data | ( | void | ) |
Definition at line 197 of file NiVMDTool.cpp.
References CBaseFrameTool::free_data().
Referenced by CNiFileTool::clearFrameData(), CNiVMDTool::free_data(), CNiVMDTool::getFramesData(), and CNiVMDTool::readFile().
|
private |
NiFrameData* CNiVMDTool::convert2FrameData(VMDJointData* motion_data, unsigned int datanum, unsigned int& framenum)
VMDの全フレームデータを共通ジョイントのフレームデータに変換する.
[in] | datanum | データの総数 |
[out] | framenum | 一意的なフレームの数 |
Definition at line 388 of file NiVMDTool.cpp.
References VMDJointData::frm_num, NiFrameData::frmn, NiJointData::index, NiFrameData::jdat, NiJointData::joint, CBaseFrameTool::joints_num, jbxwl::makeFramesData(), NiFrameData::msec, VMDJointData::posx, VMDJointData::posy, VMDJointData::posz, NiJointData::quat, VMDJointData::qutw, VMDJointData::qutx, VMDJointData::quty, VMDJointData::qutz, NiJointData::vect, VMD_GRID_UNIT, and jbxwl::VMDJointNum().
Referenced by CNiVMDTool::getFramesData().
void free_data | ( | void | ) |
Definition at line 182 of file NiVMDTool.cpp.
References CNiVMDTool::clear_data(), CNiVMDTool::dmy_frames, CNiVMDTool::dmy_frmnum, jbxwl::freeFramesData(), CNiVMDTool::vmd_datnum, and CNiVMDTool::vmd_frames.
Referenced by CNiVMDTool::~CNiVMDTool().
|
virtual |
NiFrameData* CNiVMDTool::getJointsFrame(void)
ジョイントの各フレームデータを計算し,静的なデータとして返す. ただし,VMDでは全フレームのデータがないので,ここではダミーデータを返し,実際のデータは getFrameData()で得る.
Reimplemented from CBaseFrameTool.
Definition at line 330 of file NiVMDTool.cpp.
References CNiVMDTool::calcJointRotation(), CNiVMDTool::clear_data(), CNiVMDTool::convert2FrameData(), CNiVMDTool::dmy_frames, CNiVMDTool::dmy_frmnum, CBaseFrameTool::exec_time, CBaseFrameTool::frames_num, CBaseFrameTool::framesData, NiFrameData::frmn, NiFrameData::jdat, NiFrameData::jnum, NiJointData::joint, CBaseFrameTool::joints_num, jbxwl::makeFramesData(), NiFrameData::msec, CNiVMDTool::rate_frame, CBaseFrameTool::start_time, CBaseFrameTool::stop_time, jbxwl::VMD2NiJointNum(), CNiVMDTool::vmd_datnum, CNiVMDTool::vmd_frames, and VMD_JOINT_NUM.
Referenced by CNiFileTool::readVMDFile().
|
inlinevirtual |
Reimplemented from CBaseFrameTool.
Definition at line 121 of file NiVMDTool.h.
References CNiVMDTool::dmy_frmnum.
Referenced by CNiFileTool::readVMDFile().
|
virtual |
NiJointData* CNiVMDTool::getJointsData(int frmnum, int fps)
動的にジョイントデータを計算する場合に使用する.
getJointsFrame で返したデータが NULLの場合,代わりにこの関数が呼ばれる.
フレーム frmnum時の 全ジョイントのデータを得る.戻り値は配列.
frmnumのデータが存在しない場合は,補間する.
frmnum | フレーム数 |
fps | FPS. |
Reimplemented from CBaseFrameTool.
Definition at line 713 of file NiVMDTool.cpp.
References CBaseFrameTool::clearJointsData(), CBaseFrameTool::frames_num, CBaseFrameTool::framesData, NiJointData::index, NiFrameData::jdat, NiJointData::joint, CBaseFrameTool::joints_num, CBaseFrameTool::jointsData, NiJointData::quat, NiJointData::vect, and VMD_FARME_RATE.
|
virtual |
BOOL CNiVMDTool::readFile(FILE* fp)
VMDファイルを読み込む
Reimplemented from CBaseFrameTool.
Definition at line 213 of file NiVMDTool.cpp.
References CNiVMDTool::clear_data(), CBaseFrameTool::clearJointsData(), CBaseFrameTool::clearVectorData(), VMDFileHeader::data_num, CBaseFrameTool::joints_num, CBaseFrameTool::jointsData, CBaseFrameTool::posVect, CNiVMDTool::readFileHeader(), CNiVMDTool::readJointsData(), CBaseFrameTool::rotQuat, CNiVMDTool::vmd_datnum, CNiVMDTool::vmd_frames, CNiVMDTool::vmd_header, and VMD_JOINT_NUM.
Referenced by CNiFileTool::readVMDFile().
|
private |
VMDFileHeader CNiVMDTool::readFileHeader(FILE* fp)
VMDファイルのヘッダ部を読み込む
Definition at line 255 of file NiVMDTool.cpp.
References VMDFileHeader::data_num, VMDFileHeader::header, VMDFileHeader::name, and VMD_FILE_HD_ID2.
Referenced by CNiVMDTool::readFile().
|
private |
VMDJointData CNiVMDTool::readJointData(FILE* fp)
VMDファイルから 1フレーム(ジョイント)の VMDJointDataを読み込む.
sizeof(VMDJointData)==15 + (4+4x7+64)
Definition at line 278 of file NiVMDTool.cpp.
References VMDJointData::frm_num, and VMDJointData::name.
Referenced by CNiVMDTool::readJointsData().
|
private |
VMDJointData* CNiVMDTool::readJointsData(FILE* fp, unsigned int& frmnum)
全フレーム&ジョイントの VMDJointDataを読み込む.
ジョイント間でフレームの同期は取られていない.
Definition at line 296 of file NiVMDTool.cpp.
References CNiVMDTool::readJointData().
Referenced by CNiVMDTool::readFile().
|
private |
Definition at line 129 of file NiVMDTool.h.
Referenced by CNiVMDTool::calcJointRotation(), and CNiVMDTool::CNiVMDTool().
|
private |
Definition at line 138 of file NiVMDTool.h.
Referenced by CNiVMDTool::CNiVMDTool(), CNiVMDTool::free_data(), and CNiVMDTool::getFramesData().
|
private |
Definition at line 139 of file NiVMDTool.h.
Referenced by CNiVMDTool::CNiVMDTool(), CNiVMDTool::free_data(), CNiVMDTool::getFramesData(), and CNiVMDTool::getFramesNumber().
|
private |
Definition at line 130 of file NiVMDTool.h.
Referenced by CNiVMDTool::CNiVMDTool(), and CNiVMDTool::getFramesData().
|
private |
Definition at line 135 of file NiVMDTool.h.
Referenced by CNiVMDTool::CNiVMDTool(), CNiVMDTool::free_data(), CNiVMDTool::getFramesData(), and CNiVMDTool::readFile().
|
private |
Definition at line 134 of file NiVMDTool.h.
Referenced by CNiVMDTool::CNiVMDTool(), CNiVMDTool::free_data(), CNiVMDTool::getFramesData(), and CNiVMDTool::readFile().
|
private |
Definition at line 133 of file NiVMDTool.h.
Referenced by CNiVMDTool::CNiVMDTool(), and CNiVMDTool::readFile().