本文整理汇总了C++中Skeleton::createBone方法的典型用法代码示例。如果您正苦于以下问题:C++ Skeleton::createBone方法的具体用法?C++ Skeleton::createBone怎么用?C++ Skeleton::createBone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Skeleton
的用法示例。
在下文中一共展示了Skeleton::createBone方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadBone
void MdlFileImport::loadBone( Actor* actor )
{
Skeleton* skeleton = actor->getSkeleton();
mstudiobonecontroller_t* boneCtrl = mStudioHeader->getBoneControllors();
for( int i = 0 ; i < mStudioHeader->numbonecontrollers ; ++i )
{
}
mstudiobone_t* boneVec = mStudioHeader->getBones();
assert( skeleton->getBoneNum() == 1 );
for( int i = 0 ; i < mStudioHeader->numbones; ++i )
{
mstudiobone_t& boneDesc = boneVec[i];
BoneNode* bone;
skeleton->createBone( boneDesc.name , boneDesc.parent + 1 );
for( int n = 0 ; n < 6 ;++n )
{
if ( boneDesc.bonecontroller[n] != -1 )
{
int kk = 1;
}
}
}
int totalFrame = 0;
mstudioseqdesc_t* seqVec = mStudioHeader->getSequences();
for ( int i = 0 ; i < mStudioHeader->numseq ; ++i )
{
mstudioseqdesc_t& curSeq = seqVec[i];
AnimationState* state = actor->createAnimationState( curSeq.label , totalFrame , totalFrame + seqVec[i].numframes - 1 );
state->setTimeScale( curSeq.fps / 30.0f );
totalFrame += curSeq.numframes;
}
skeleton->createMotionData( totalFrame );
totalFrame = 0;
for ( int i = 0 ; i < mStudioHeader->numseq ; ++i )
{
mstudioseqdesc_t& curSeq = seqVec[i];
for( int frame = 0 ; frame < curSeq.numframes ; ++frame )
{
loadMotionData( skeleton , curSeq , frame , totalFrame );
}
totalFrame += curSeq.numframes;
}
}
示例2: createDefaultSkeleton
Skeleton MoCapManager::createDefaultSkeleton() const
{
Skeleton skeleton;
Bone boneData;
// hip - this will be the anchor of the skeleton
boneData.setStartPos(Vector3(0.0, 1.0, 0.0));
boneData.setLength(0.001);
boneData.setDefaultOrientation(Quaternion(Vector3(0.0, 0.0, 1.0), M_PI*90.0/180.0) * Quaternion(Vector3(-1.0, 0.0, 0.0), M_PI*90.0/180.0));
boneData.setName("hip");
int hip = skeleton.createBone(boneData);
// hip - neck (i.e. the body)
boneData.setLength(0.55);
boneData.setDefaultOrientation(Quaternion(Vector3(0.0, 0.0, 1.0), M_PI*90.0/180.0) * Quaternion(Vector3(-1.0, 0.0, 0.0), M_PI*90.0/180.0));
boneData.setName("body");
int neck = skeleton.createBone(boneData, hip);
// neck - head
boneData.setLength(0.30);
boneData.setDefaultOrientation(Quaternion(Vector3(0.0, 0.0, 1.0), M_PI*90.0/180.0) * Quaternion(Vector3(-1.0, 0.0, 0.0), M_PI*90.0/180.0));
boneData.setName("head");
skeleton.createBone(boneData, neck);
// neck - right shoulder
boneData.setLength(0.20);
boneData.setDefaultOrientation(Quaternion(1.0, 0.0, 0.0, 0.0));
boneData.setName("rShoulder");
int rShoulder = skeleton.createBone(boneData, neck);
// right upper arm
boneData.setLength(0.35);
boneData.setDefaultOrientation(Quaternion(1.0, 0.0, 0.0, 0.0));
boneData.setName("rUpperArm");
int rUpperArm = skeleton.createBone(boneData, rShoulder);
// right lower arm
boneData.setLength(0.30);
boneData.setDefaultOrientation(Quaternion(1.0, 0.0, 0.0, 0.0));
boneData.setName("rLowerArm");
skeleton.createBone(boneData, rUpperArm);
/*
// right upper arm sensor
boneData.setLength(0.35);
boneData.setDefaultOrientation(Quaternion(1.0, 0.0, 0.0, 0.0));
boneData.setName("rUpperArmSensor");
int rUpperArmS = skeleton.createBone(boneData, rShoulder);
// right lower arm sensor
boneData.setLength(0.30);
boneData.setDefaultOrientation(Quaternion(1.0, 0.0, 0.0, 0.0));
boneData.setName("rLowerArmSensor");
skeleton.createBone(boneData, rUpperArmS);
*/
// neck - left shoulder
boneData.setLength(0.20);
boneData.setDefaultOrientation(Quaternion(Vector3(0.0, 1.0, 0.0), M_PI*180.0/180.0));
boneData.setName("lShoulder");
int lShoulder = skeleton.createBone(boneData, neck);
// left upper arm
boneData.setLength(0.35);
boneData.setDefaultOrientation(Quaternion(Vector3(0.0, 1.0, 0.0), M_PI*180.0/180.0));
boneData.setName("lUpperArm");
int lUpperArm = skeleton.createBone(boneData, lShoulder);
// left lower arm
boneData.setLength(0.30);
boneData.setDefaultOrientation(Quaternion(Vector3(0.0, 1.0, 0.0), M_PI*180.0/180.0));
boneData.setName("lLowerArm");
skeleton.createBone(boneData, lUpperArm);
/*
// left upper arm sensor
boneData.setLength(0.35);
boneData.setDefaultOrientation(Quaternion(Vector3(0.0, 1.0, 0.0), M_PI*180.0/180.0));
boneData.setName("lUpperArmSensor");
int lUpperArmS = skeleton.createBone(boneData, lShoulder);
// left lower arm sensor
boneData.setLength(0.30);
boneData.setDefaultOrientation(Quaternion(Vector3(0.0, 1.0, 0.0), M_PI*180.0/180.0));
boneData.setName("lLowerArmSensor");
skeleton.createBone(boneData, lUpperArmS);
*/
// hip - right leg
boneData.setLength(0.20);
boneData.setDefaultOrientation(Quaternion(1.0, 0.0, 0.0, 0.0));
boneData.setName("rHip");
int rHip = skeleton.createBone(boneData, hip);
// right upper leg
boneData.setLength(0.45);
boneData.setDefaultOrientation(Quaternion(Vector3(0.0, 0.0, -1.0), M_PI*90.0/180.0) * Quaternion(Vector3(-1.0, 0.0, 0.0), M_PI*90.0/180.0));
boneData.setName("rUpperLeg");
int rUpperLeg = skeleton.createBone(boneData, rHip);
//.........这里部分代码省略.........