本文整理汇总了C++中NodeAnimationTrack::getAssociatedNode方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeAnimationTrack::getAssociatedNode方法的具体用法?C++ NodeAnimationTrack::getAssociatedNode怎么用?C++ NodeAnimationTrack::getAssociatedNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeAnimationTrack
的用法示例。
在下文中一共展示了NodeAnimationTrack::getAssociatedNode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _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;
}
}
}
}
示例2: 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);
}
}