本文整理汇总了C++中Skeleton::getParentJoints方法的典型用法代码示例。如果您正苦于以下问题:C++ Skeleton::getParentJoints方法的具体用法?C++ Skeleton::getParentJoints怎么用?C++ Skeleton::getParentJoints使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Skeleton
的用法示例。
在下文中一共展示了Skeleton::getParentJoints方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getSkeleton
Action::ResultE
SkeletonOgreJoint::jointUpdateEnter(JointTraverser *jt)
{
Action::ResultE res = Action::Continue;
Skeleton *skel = getSkeleton();
#ifdef OSG_DEBUG
if(_sfJointId.getValue() == INVALID_JOINT_ID)
{
SWARNING << "SkeletonOgreJoint::jointUpdateEnter: "
<< "Joint has invalid jointId. Ignoring." << std::endl;
return res;
}
if(skel == NULL)
{
SWARNING << "SkeletonOgreJoint::jointUpdateEnter: "
<< "Joint has no skeleton. Ignoring." << std::endl;
return res;
}
#endif
Int16 jointId = getJointId();
Skeleton::MFJointMatricesType *jointMats =
skel->editMFJointMatrices();
SkeletonOgreJoint *parentJoint =
dynamic_cast<SkeletonOgreJoint *>(skel->getParentJoints(jointId));
if(parentJoint != NULL)
{
_accumRotate = parentJoint->_accumRotate;
_accumRotate.mult(getRotate ());
_accumRotate.mult(getOffsetRotate());
_accumScale = parentJoint->_accumScale;
_accumScale[0] *= getScale()[0] * getOffsetScale()[0];
_accumScale[1] *= getScale()[1] * getOffsetScale()[1];
_accumScale[2] *= getScale()[2] * getOffsetScale()[2];
_accumTranslate = getTranslate() + getOffsetTranslate();
_accumTranslate[0] *= parentJoint->_accumScale[0];
_accumTranslate[1] *= parentJoint->_accumScale[1];
_accumTranslate[2] *= parentJoint->_accumScale[2];
parentJoint->_accumRotate.multVec(_accumTranslate, _accumTranslate);
_accumTranslate += parentJoint->_accumTranslate;
}
else
{
_accumRotate = getRotate();
_accumRotate.mult(getOffsetRotate());
_accumScale = getScale();
_accumScale[0] *= getOffsetScale()[0];
_accumScale[1] *= getOffsetScale()[1];
_accumScale[2] *= getOffsetScale()[2];
_accumTranslate = getTranslate() + getOffsetTranslate();
}
Quaternion jointRotate (_accumRotate );
Vec3f jointTranslate(_accumTranslate);
Vec3f jointScale (_accumScale );
if(skel->getUseInvBindMatrix() == true)
{
jointRotate.mult(getInvBindRotate());
jointScale[0] *= getInvBindScale()[0];
jointScale[1] *= getInvBindScale()[1];
jointScale[2] *= getInvBindScale()[2];
jointTranslate[0] = jointScale[0] * getInvBindTranslate()[0];
jointTranslate[1] = jointScale[1] * getInvBindTranslate()[1];
jointTranslate[2] = jointScale[2] * getInvBindTranslate()[2];
jointRotate.multVec(jointTranslate, jointTranslate);
jointTranslate += _accumTranslate;
}
Matrix matJoint;
matJoint.setTransform(jointTranslate, jointRotate, jointScale);
(*jointMats)[jointId] = matJoint;
return res;
}