当前位置: 首页>>代码示例>>C++>>正文


C++ Skeleton::getParentJoints方法代码示例

本文整理汇总了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;
}
开发者ID:DaveHarrison,项目名称:OpenSGDevMaster,代码行数:87,代码来源:OSGSkeletonOgreJoint.cpp


注:本文中的Skeleton::getParentJoints方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。