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


C++ Matrix::preMultTranslate方法代码示例

本文整理汇总了C++中osg::Matrix::preMultTranslate方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix::preMultTranslate方法的具体用法?C++ Matrix::preMultTranslate怎么用?C++ Matrix::preMultTranslate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在osg::Matrix的用法示例。


在下文中一共展示了Matrix::preMultTranslate方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: readTranslationElement

void readTranslationElement(KFbxTypedProperty<fbxDouble3>& prop,
                            osgAnimation::UpdateMatrixTransform* pUpdate,
                            osg::Matrix& staticTransform)
{
    fbxDouble3 fbxPropValue = prop.Get();
    osg::Vec3d val(
        fbxPropValue[0],
        fbxPropValue[1],
        fbxPropValue[2]);

    if (prop.GetKFCurve(KFCURVENODE_T_X) ||
        prop.GetKFCurve(KFCURVENODE_T_Y) ||
        prop.GetKFCurve(KFCURVENODE_T_Z))
    {
        if (!staticTransform.isIdentity())
        {
            pUpdate->getStackedTransforms().push_back(new osgAnimation::StackedMatrixElement(staticTransform));
            staticTransform.makeIdentity();
        }
        pUpdate->getStackedTransforms().push_back(new osgAnimation::StackedTranslateElement("translate", val));
    }
    else
    {
        staticTransform.preMultTranslate(val);
    }
}
开发者ID:crimzon,项目名称:osg,代码行数:26,代码来源:fbxRNode.cpp

示例2: readTranslationElement

void readTranslationElement(FbxPropertyT<FbxDouble3>& prop,
                            osgAnimation::UpdateMatrixTransform* pUpdate,
                            osg::Matrix& staticTransform,
                            FbxScene& fbxScene)
{
    FbxDouble3 fbxPropValue = prop.Get();
    osg::Vec3d val(
        fbxPropValue[0],
        fbxPropValue[1],
        fbxPropValue[2]);

    if (isAnimated(prop, fbxScene))
    {
        if (!staticTransform.isIdentity())
        {
            pUpdate->getStackedTransforms().push_back(new osgAnimation::StackedMatrixElement(staticTransform));
            staticTransform.makeIdentity();
        }
        pUpdate->getStackedTransforms().push_back(new osgAnimation::StackedTranslateElement("translate", val));
    }
    else
    {
        staticTransform.preMultTranslate(val);
    }
}
开发者ID:Jeff885,项目名称:osg,代码行数:25,代码来源:fbxRNode.cpp

示例3: computeLocalToWorldMatrix

 /** Get the transformation matrix which moves from local coords to world coords.*/
 virtual bool computeLocalToWorldMatrix(osg::Matrix& matrix,osg::NodeVisitor* nv) const 
 {
     osgUtil::CullVisitor* cv = dynamic_cast<osgUtil::CullVisitor*>(nv);
     if (cv)
     {
         osg::Vec3 eyePointLocal = cv->getEyeLocal();
         matrix.preMultTranslate(osg::Vec3(eyePointLocal.x(),eyePointLocal.y(),0.0f));
     }
     return true;
 }
开发者ID:yueying,项目名称:osg,代码行数:11,代码来源:osghangglide.cpp

示例4: computeWorldToLocalMatrix

bool AbstractHimmel::computeWorldToLocalMatrix(osg::Matrix& matrix, osg::NodeVisitor* nv) const
{
    osgUtil::CullVisitor* cv = dynamic_cast<osgUtil::CullVisitor*>(nv);
    if(!cv)
        return false;

    const osg::Vec3f t(cv->getEyePoint());
    matrix.preMultTranslate(-t);

    return true;
}
开发者ID:helsing72,项目名称:osghimmel,代码行数:11,代码来源:abstracthimmel.cpp

示例5: computeLocalToWorldMatrix

        bool computeLocalToWorldMatrix(osg::Matrix& matrix,osg::NodeVisitor* nv) const
        {
            osg::Quat billboardRotation;
            osgUtil::CullVisitor* cullvisitor = dynamic_cast<osgUtil::CullVisitor*>(nv);
            if (cullvisitor)
            {
                osg::Vec3 eyevector = cullvisitor->getEyeLocal()-_position;
                eyevector.normalize();

                osg::Vec3 side = _axis^_normal;
                side.normalize();

                float angle = atan2(eyevector*_normal,eyevector*side);
                billboardRotation.makeRotate(osg::PI_2-angle,_axis);

            }

            matrix.preMultTranslate(_position);
            matrix.preMultRotate(billboardRotation);
            matrix.preMultRotate(_attitude);
            matrix.preMultTranslate(-_pivotPoint);
            return true;
        }
开发者ID:BodyViz,项目名称:osg,代码行数:23,代码来源:osglogo.cpp

示例6: makeLocalMatrix

void makeLocalMatrix(const FbxNode* pNode, osg::Matrix& m)
{
    /*From http://area.autodesk.com/forum/autodesk-fbx/fbx-sdk/the-makeup-of-the-local-matrix-of-an-kfbxnode/

    Local Matrix = LclTranslation * RotationOffset * RotationPivot *
      PreRotation * LclRotation * PostRotation * RotationPivotInverse *
      ScalingOffset * ScalingPivot * LclScaling * ScalingPivotInverse

    LocalTranslation : translate (xform -query -translation)
    RotationOffset: translation compensates for the change in the rotate pivot point (xform -q -rotateTranslation)
    RotationPivot: current rotate pivot position (xform -q -rotatePivot)
    PreRotation : joint orientation(pre rotation)
    LocalRotation: rotate transform (xform -q -rotation & xform -q -rotateOrder)
    PostRotation : rotate axis (xform -q -rotateAxis)
    RotationPivotInverse: inverse of RotationPivot
    ScalingOffset: translation compensates for the change in the scale pivot point (xform -q -scaleTranslation)
    ScalingPivot: current scale pivot position (xform -q -scalePivot)
    LocalScaling: scale transform (xform -q -scale)
    ScalingPivotInverse: inverse of ScalingPivot
    */

    // When this flag is set to false, the RotationOrder, the Pre/Post rotation
    // values and the rotation limits should be ignored.
    bool rotationActive = pNode->RotationActive.Get();

    EFbxRotationOrder fbxRotOrder = rotationActive ? pNode->RotationOrder.Get() : eEulerXYZ;

    FbxDouble3 fbxLclPos = pNode->LclTranslation.Get();
    FbxDouble3 fbxRotOff = pNode->RotationOffset.Get();
    FbxDouble3 fbxRotPiv = pNode->RotationPivot.Get();
    FbxDouble3 fbxPreRot = pNode->PreRotation.Get();
    FbxDouble3 fbxLclRot = pNode->LclRotation.Get();
    FbxDouble3 fbxPostRot = pNode->PostRotation.Get();
    FbxDouble3 fbxSclOff = pNode->ScalingOffset.Get();
    FbxDouble3 fbxSclPiv = pNode->ScalingPivot.Get();
    FbxDouble3 fbxLclScl = pNode->LclScaling.Get();

    m.makeTranslate(osg::Vec3d(
                        fbxLclPos[0] + fbxRotOff[0] + fbxRotPiv[0],
                        fbxLclPos[1] + fbxRotOff[1] + fbxRotPiv[1],
                        fbxLclPos[2] + fbxRotOff[2] + fbxRotPiv[2]));
    if (rotationActive)
    {
        m.preMultRotate(
            makeQuat(fbxPostRot, fbxRotOrder) *
            makeQuat(fbxLclRot, fbxRotOrder) *
            makeQuat(fbxPreRot, fbxRotOrder));
    }
    else
    {
        m.preMultRotate(makeQuat(fbxLclRot, fbxRotOrder));
    }
    m.preMultTranslate(osg::Vec3d(
                           fbxSclOff[0] + fbxSclPiv[0] - fbxRotPiv[0],
                           fbxSclOff[1] + fbxSclPiv[1] - fbxRotPiv[1],
                           fbxSclOff[2] + fbxSclPiv[2] - fbxRotPiv[2]));
    m.preMultScale(osg::Vec3d(fbxLclScl[0], fbxLclScl[1], fbxLclScl[2]));
    m.preMultTranslate(osg::Vec3d(
                           -fbxSclPiv[0],
                           -fbxSclPiv[1],
                           -fbxSclPiv[2]));
}
开发者ID:Jeff885,项目名称:osg,代码行数:62,代码来源:fbxRNode.cpp

示例7: applyToMatrix

void StackedTranslateElement::applyToMatrix(osg::Matrix& matrix) const {matrix.preMultTranslate(_translate);}
开发者ID:Stupeflix,项目名称:osg,代码行数:1,代码来源:StackedTranslateElement.cpp


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