本文整理汇总了C++中TransformKeyFrame::getTime方法的典型用法代码示例。如果您正苦于以下问题:C++ TransformKeyFrame::getTime方法的具体用法?C++ TransformKeyFrame::getTime怎么用?C++ TransformKeyFrame::getTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TransformKeyFrame
的用法示例。
在下文中一共展示了TransformKeyFrame::getTime方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bake
SkeletonPtr MergeSkeleton::bake()
{
MeshCombiner::getSingleton().log(
"Baking: New Skeleton started" );
SkeletonPtr sp = SkeletonManager::getSingleton().create( "mergeSkeleton",
ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, true );
for( std::vector< Ogre::SkeletonPtr >::iterator it = m_Skeletons.begin();
it != m_Skeletons.end(); ++it )
{
if( it == m_Skeletons.begin() )
{
MeshCombiner::getSingleton().log(
"Baking: using " + (*it)->getName() + " as the base skeleton" );
MeshCombiner::getSingleton().log(
"Baking: adding bones" );
Skeleton::BoneIterator bit = (*it)->getBoneIterator();
while( bit.hasMoreElements() )
{
Bone* bone = bit.getNext();
Bone* newbone = sp->createBone( bone->getName(), bone->getHandle() );
newbone->setScale( bone->getScale() );
newbone->setOrientation( bone->getOrientation() );
newbone->setPosition( bone->getPosition() );
}
MeshCombiner::getSingleton().log(
"Baking: building bone hierarchy" );
// bone hierarchy
bit = (*it)->getBoneIterator();
while( bit.hasMoreElements() )
{
Bone* bone = bit.getNext();
Node* pnode = bone->getParent();
if( pnode != NULL )
{
Bone* pbone = static_cast<Bone*>( pnode );
sp->getBone( pbone->getHandle() )->addChild( sp->getBone( bone->getHandle() ) );
}
}
}
MeshCombiner::getSingleton().log(
"Baking: adding animations for " + (*it)->getName() );
// insert all animations
for (unsigned short a=0; a < (*it)->getNumAnimations(); ++a )
{
Animation* anim = (*it)->getAnimation( a );
Animation* newanim = sp->createAnimation( anim->getName(), anim->getLength() );
if( anim->getNumNodeTracks() > 0 )
MeshCombiner::getSingleton().log(
"Baking: adding node tracks" );
for( unsigned short na=0; na < anim->getNumNodeTracks(); ++na )
{
if( anim->hasNodeTrack( na ) )
{
NodeAnimationTrack* nat = anim->getNodeTrack( na );
NodeAnimationTrack* newnat = newanim->createNodeTrack( na );
// all key frames
for( unsigned short nf=0; nf < nat->getNumKeyFrames(); ++nf )
{
TransformKeyFrame* tkf = nat->getNodeKeyFrame( nf );
TransformKeyFrame* newtkf = newnat->createNodeKeyFrame( tkf->getTime() );
newtkf->setRotation( tkf->getRotation() );
newtkf->setTranslate( tkf->getTranslate() );
newtkf->setScale( tkf->getScale() );
}
newnat->setAssociatedNode( sp->getBone( nat->getHandle() ) );
}
}
if( anim->getNumNumericTracks() > 0 )
MeshCombiner::getSingleton().log(
"Baking: adding numeric tracks" );
for( unsigned short na=0; na < anim->getNumNumericTracks(); ++na )
{
if( anim->hasNumericTrack( na ) )
{
NumericAnimationTrack* nat = anim->getNumericTrack( na );
NumericAnimationTrack* newnat = newanim->createNumericTrack( na );
// all key frames
for( unsigned short nf=0; nf < nat->getNumKeyFrames(); ++nf )
{
NumericKeyFrame* nkf = nat->getNumericKeyFrame( nf );
NumericKeyFrame* newnkf = newnat->createNumericKeyFrame( nkf->getTime() );
newnkf->setValue( nkf->getValue() );
}
}
}
if( anim->getNumVertexTracks() > 0 )
MeshCombiner::getSingleton().log(
"Baking: adding vertex tracks" );
for( unsigned short va=0; va < anim->getNumVertexTracks(); ++va )
{
//.........这里部分代码省略.........
示例2: _dumpContents
//---------------------------------------------------------------------
void Skeleton::_dumpContents(const String& filename)
{
std::ofstream of;
Quaternion q;
Radian angle;
Vector3 axis;
of.open(filename.c_str());
of << "-= Debug output of skeleton " << mName << " =-" << std::endl << std::endl;
of << "== Bones ==" << std::endl;
of << "Number of bones: " << (unsigned int)mBoneList.size() << std::endl;
BoneList::iterator bi;
for (bi = mBoneList.begin(); bi != mBoneList.end(); ++bi)
{
Bone* bone = *bi;
of << "-- Bone " << bone->getHandle() << " --" << std::endl;
of << "Position: " << bone->getPosition();
q = bone->getOrientation();
of << "Rotation: " << q;
q.ToAngleAxis(angle, axis);
of << " = " << angle.valueRadians() << " radians around axis " << axis << std::endl << std::endl;
}
of << "== Animations ==" << std::endl;
of << "Number of animations: " << (unsigned int)mAnimationsList.size() << std::endl;
AnimationList::iterator ai;
for (ai = mAnimationsList.begin(); ai != mAnimationsList.end(); ++ai)
{
Animation* anim = ai->second;
of << "-- Animation '" << anim->getName() << "' (length " << anim->getLength() << ") --" << std::endl;
of << "Number of tracks: " << anim->getNumNodeTracks() << std::endl;
for (unsigned short ti = 0; ti < anim->getNumNodeTracks(); ++ti)
{
NodeAnimationTrack* track = anim->getNodeTrack(ti);
of << " -- AnimationTrack " << ti << " --" << std::endl;
of << " Affects bone: " << ((Bone*)track->getAssociatedNode())->getHandle() << std::endl;
of << " Number of keyframes: " << track->getNumKeyFrames() << std::endl;
for (unsigned short ki = 0; ki < track->getNumKeyFrames(); ++ki)
{
TransformKeyFrame* key = track->getNodeKeyFrame(ki);
of << " -- KeyFrame " << ki << " --" << std::endl;
of << " Time index: " << key->getTime();
of << " Translation: " << key->getTranslate() << std::endl;
q = key->getRotation();
of << " Rotation: " << q;
q.ToAngleAxis(angle, axis);
of << " = " << angle.valueRadians() << " radians around axis " << axis << std::endl;
}
}
}
}
示例3: ExportSkeleton
void ModelConverter::ExportSkeleton( const Ogre::Skeleton* pSkeleton, const Ogre::String& filename )
{
LogManager::getSingleton().logMessage("Populating DOM...");
// Write main skeleton data
LogManager::getSingleton().logMessage("Exporting bones..");
DiMotionPtr mt = Demi::DiAssetManager::GetInstancePtr(
)->CreateOrReplaceAsset<DiMotion>(pSkeleton->getName().c_str());
DiSkeleton* skeleton = mt->CreateSkeleton();
// save bones
WriteSkeleton(pSkeleton,skeleton);
LogManager::getSingleton().logMessage("Bones exported.");
unsigned short numAnims = pSkeleton->getNumAnimations();
String msg = "Exporting animations, count=" + StringConverter::toString(numAnims);
LogManager::getSingleton().logMessage(msg);
// save animations
for (unsigned short i = 0; i < numAnims; ++i)
{
Animation* pAnim = pSkeleton->getAnimation(i);
msg = "Exporting animation: " + pAnim->getName();
LogManager::getSingleton().logMessage(msg);
Demi::DiAnimation* anim = mt->CreateAnimation(
pAnim->getName().c_str(), pAnim->getLength());
// save tracks
Animation::NodeTrackIterator trackIt = pAnim->getNodeTrackIterator();
size_t count = 0;
while (trackIt.hasMoreElements())
{
NodeAnimationTrack* track = trackIt.getNext();
Bone* bone = (Bone*)track->getAssociatedNode();
Demi::DiNodeClip* clip = anim->CreateNodeClip(count++,skeleton->GetBone(bone->getHandle()));
// save key frames
for (unsigned short i = 0; i < track->getNumKeyFrames(); ++i)
{
TransformKeyFrame* kf = track->getNodeKeyFrame(i);
Demi::DiTransformKeyFrame* pKeyframe = clip->CreateNodeKeyFrame(kf->getTime());
pKeyframe->SetTranslate(Demi::DiVec3(kf->getTranslate().x,
kf->getTranslate().y,kf->getTranslate().z));
pKeyframe->SetRotation(Demi::DiQuat(kf->getRotation().w,
kf->getRotation().x,kf->getRotation().y,kf->getRotation().z));
pKeyframe->SetScale(Demi::DiVec3(kf->getScale().x,
kf->getScale().y,kf->getScale().z));
}
}
LogManager::getSingleton().logMessage("Animation exported.");
}
if (mt)
{
// save to file
DiMotionSerializer ms;
ms.ExportMotion(mt,filename);
}
}