本文整理汇总了C++中TransformKeyFrame::setTranslation方法的典型用法代码示例。如果您正苦于以下问题:C++ TransformKeyFrame::setTranslation方法的具体用法?C++ TransformKeyFrame::setTranslation怎么用?C++ TransformKeyFrame::setTranslation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TransformKeyFrame
的用法示例。
在下文中一共展示了TransformKeyFrame::setTranslation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: saveKeyFrame
size_t Recording::saveKeyFrame(float now)
{
if (nullptr == animation) return 0;
// Get the Kinect skeleton data if there is any
const auto& skeletonFrame = kinect.getSkeletonFrame();
const auto *skeletonData = kinect.getFirstTrackedSkeletonData(skeletonFrame);
const auto *boneOrientations = kinect.getOrientations();
if (nullptr == skeletonData) return 0;
// Update all bone tracks with a new keyframe
BoneAnimationTrack *track = nullptr;
TransformKeyFrame *keyFrame = nullptr;
size_t numKeyFrames = 0;
for (auto boneID = 0; boneID < EBoneID::COUNT; ++boneID) {
track = animation->getBoneTrack(boneID);
if (nullptr == track) continue;
keyFrame = static_cast<TransformKeyFrame*>(track->createKeyFrame(now));
if (nullptr == keyFrame) continue;
const Vector4& p = skeletonData->SkeletonPositions[boneID];
const Vector4& q = boneOrientations[boneID].hierarchicalRotation.rotationQuaternion;
const Vector4& a = boneOrientations[boneID].absoluteRotation.rotationQuaternion;
keyFrame->setTranslation(glm::vec3(p.x, p.y, p.z));
keyFrame->setRotation(glm::normalize(glm::quat(q.w, q.x, q.y, q.z)));
keyFrame->setAbsRotation(glm::normalize(glm::quat(a.w, a.x, a.y, a.z)));
keyFrame->setScale(glm::vec3(1));
numKeyFrames += track->getNumKeyFrames();
}
return numKeyFrames;
}