5 #define MAX_NODE_NUM 100 6 #define MAX_CHILDBONE 6 125 inline int GetChildCount(){
126 return (
int)m_childBones.size();
128 inline bool IsUnKnownBone(){
return m_sMarkerName.empty();};
129 inline float GetBoneLength(){
return m_fBoneLength;}
141 bool operator()(
const int& _Left,
const int& _Right)
const 143 return (((*m_pBones)[_Left].m_nSubLevels > (*m_pBones)[_Right].m_nSubLevels) ||
144 ((((*m_pBones)[_Left].m_nSubLevels == (*m_pBones)[_Right].m_nSubLevels)) && (*m_pBones)[_Left].m_fBoneLength > (*m_pBones)[_Right].m_fBoneLength) );
147 vector<UniBone>* m_pBones;
157 bool operator()(
const int& _Left,
const int& _Right)
const 160 if((*m_pBones)[_Right].m_sMarkerName.empty())
162 else if((*m_pBones)[_Left].m_sMarkerName.empty())
164 else if((*m_pBones)[_Left].m_sMarkerName[0] ==
'L' && (*m_pBones)[_Right].m_sMarkerName[0] ==
'R')
166 else if((*m_pBones)[_Right].m_sMarkerName[0] ==
'C' || (*m_pBones)[_Right].m_sMarkerName[0] ==
'N')
172 vector<UniBone>* m_pBones;
177 C7=0,CLAV,LANK,LBHD, LBWT, LELB, LFHD, LFIN, LFWT, LKNE, LMT5, LSHO, LTOE, LWRE, LWRI, RANK, RBHD, RBWT, RELB, RFHD, RFIN, RFWT, RKNE, RMT5, RSHO, RTOE, RWRE, RWRI, STRN, T10,
179 enum UniversalNodeEnum{
188 UN_Spine1,UN_Spine2,UN_Spine3,UN_Spine4,
199 void SaveCSM(
const string& sFileName);
229 bool SaveBVH(
const string& sFileName,
const string& sMarkerNameFile);
233 vector <MotionCaptureNode> m_nodes;
239 vector<UniBone> m_bones;
240 int m_BVHnodes[MAX_BVH_NODE];
245 int m_nRootBoneIndex;
254 bool m_bEscapeUnknownBones;
257 bool m_bEscapeUnmarkedBones;
260 bool m_bExportBVHPosition;
264 bool m_bSwapChestHip;
267 int m_nChestBoneIndex;
272 bool BuildInternalBones();
275 bool BuildBipedUniversalBones();
278 inline int GetBoneIndex(
int nIndex){
return m_UniversalNodes[(UniversalNodeEnum)nIndex].m_nBoneIndex;};
281 int GetBoneCount(){
return (
int)m_nodes.size();};
284 bool DumpUniversalBones();
286 bool DumpParaXBones(
int nLevel,
int nBoneIndex,
CParaFile* pFile = NULL);
288 bool WriteBVHNode(
int nLevel,
int nBoneIndex,
CParaFile* pFile,
bool bEscapeUnknownBones =
true);
289 bool WriteBVHNodeAnimation(
int nLevel,
int nBoneIndex,
CParaFile* pFile,
bool bEscapeUnknownBones =
true);
291 bool BeginBVHNode(
CParaFile* pFile,
int nLevel,
const string& sMarker,
const Vector3& vOffset,
bool bExportPos,
bool bExportRot);
292 bool EndBVHNode(
CParaFile* pFile,
int nLevel,
const string& sMarker);
294 bool WriteEndSite(
CParaFile* pFile,
int nLevel,
int nBoneIndex);
297 bool WriteHips(
int nLevel,
bool bHierachy,
CParaFile* pFile);
298 bool WriteLeftHip(
int nLevel,
bool bHierachy,
CParaFile* pFile);
299 bool WriteLeftKnee(
int nLevel,
bool bHierachy,
CParaFile* pFile);
300 bool WriteLeftAnkle(
int nLevel,
bool bHierachy,
CParaFile* pFile);
301 bool WriteLeftToe(
int nLevel,
bool bHierachy,
CParaFile* pFile);
303 bool WriteRightHip(
int nLevel,
bool bHierachy,
CParaFile* pFile);
304 bool WriteRightKnee(
int nLevel,
bool bHierachy,
CParaFile* pFile);
305 bool WriteRightAnkle(
int nLevel,
bool bHierachy,
CParaFile* pFile);
306 bool WriteRightToe(
int nLevel,
bool bHierachy,
CParaFile* pFile);
309 bool WriteChest(
int nLevel,
bool bHierachy,
CParaFile* pFile);
310 bool WriteChest2(
int nLevel,
bool bHierachy,
CParaFile* pFile);
311 bool WriteNeck(
int nLevel,
bool bHierachy,
CParaFile* pFile);
312 bool WriteHead(
int nLevel,
bool bHierachy,
CParaFile* pFile);
313 bool WriteLeftCollar(
int nLevel,
bool bHierachy,
CParaFile* pFile);
314 bool WriteLeftShoulder(
int nLevel,
bool bHierachy,
CParaFile* pFile);
315 bool WriteLeftElbow(
int nLevel,
bool bHierachy,
CParaFile* pFile);
316 bool WriteLeftWrist(
int nLevel,
bool bHierachy,
CParaFile* pFile);
317 bool WriteLeftFinger0(
int nLevel,
bool bHierachy,
CParaFile* pFile);
318 bool WriteRightCollar(
int nLevel,
bool bHierachy,
CParaFile* pFile);
319 bool WriteRightShoulder(
int nLevel,
bool bHierachy,
CParaFile* pFile);
320 bool WriteRightElbow(
int nLevel,
bool bHierachy,
CParaFile* pFile);
321 bool WriteRightWrist(
int nLevel,
bool bHierachy,
CParaFile* pFile);
322 bool WriteRightFinger0(
int nLevel,
bool bHierachy,
CParaFile* pFile);
327 int ComputeSubBonesCount(
int nBoneIndex);
330 bool SaveMarkerFile(
const string& sFileName);
333 bool LoadMarkerFile(
const string& sFileName);
340 int GetMarkedParentIndex(
int nIndex);
343 bool UpdateCriticalBone(
int nBoneIndex);
346 bool SortBVHMarker();
348 bool AutoGenerateBVHMarker(
int nBoneIndex,
bool bGenChest,
bool bGenHips);
351 bool GenHipMarker(
int nBoneIndex,
int* ChestBoneIndex);
353 bool GenChestMarker(
int nBoneIndex);
const Vector3 & GetOffset()
get relative offset to the parent bone
Definition: BVHSerializer.h:131
Vector3 m_vAbsOffset
absolute offset in object space.
Definition: BVHSerializer.h:119
string m_sMarkerName
maker name for BVH or CSM, default is bone ID.
Definition: BVHSerializer.h:121
Definition: BVHSerializer.h:97
Vector3 m_vOffsetToParent
relative offset to the parent bone
Definition: BVHSerializer.h:115
Definition: BVHSerializer.h:150
int m_nSubLevels
how many levels are the child objects
Definition: BVHSerializer.h:113
different physics engine has different winding order.
Definition: EventBinding.h:32
bool m_bCriticalBone
a bone is a critical bone, if this bone or any of its child has a marker name.
Definition: BVHSerializer.h:123
vector< int > m_childBones
array of index of the child bones.
Definition: BVHSerializer.h:109
Implementation of a Quaternion, i.e.
Definition: ParaQuaternion.h:10
Standard 3-dimensional vector.
Definition: ParaVector3.h:16
string m_nodeName
name of the motion capture node, it is mostly predefined.
Definition: BVHSerializer.h:100
int m_nParentIndex
index of the parent bone
Definition: BVHSerializer.h:107
Definition: BVHSerializer.h:105
it presents a real or virtual file in ParaEngine.
Definition: ParaFile.h:31
CharacterStudioNodeEnum
predefined CSM file node.
Definition: BVHSerializer.h:176
Definition: BVHSerializer.h:134
float m_fBoneLength
this is a pre-calculated value for |m_vOffsetToParent|
Definition: BVHSerializer.h:117
ParaX model is the model file for character animation, etc in the game world.
Definition: ParaXModel.h:30
int m_nBoneIndex
to which bone this motion capture node is mapped to.By default this is -1, which means that it maps t...
Definition: BVHSerializer.h:102
BioVision Hierarchy (BVH) motion capture file serializer for ParaX file.
Definition: BVHSerializer.h:23
int m_nSubBones
number of bones.
Definition: BVHSerializer.h:111