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


C++ Transform::computeLocalToWorldMatrix方法代码示例

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


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

示例1: apply

void CURRENT_CLASS::apply(osg::Transform &transform)
{
    if(shouldContinueTraversal(transform))
    {
        // Compute transform for current node
        osg::Matrix currMatrix = _viewMatrices.back();
        bool pushMatrix = transform.computeLocalToWorldMatrix(currMatrix,this);

        if(pushMatrix)
        {
            // Store the new modelview matrix and view frustum
            _viewMatrices.push_back(currMatrix);
            pushLocalFrustum();
        }

        ++_currentDepth;
        traverse(transform);
        --_currentDepth;

        if(pushMatrix)
        {
            // Restore the old modelview matrix and view frustum
            _localFrusta.pop_back();
            _bbCorners.pop_back();
            _viewMatrices.pop_back();
        }
    }
}
开发者ID:dacevedofeliz,项目名称:calvr,代码行数:28,代码来源:DistanceAccumulator.cpp

示例2: apply

void ComputeTrianglesVisitor::apply( osg::Transform& node )
{
    osg::Matrix matrix = _matrixStack.back();
    node.computeLocalToWorldMatrix( matrix, this );
    
    _matrixStack.push_back( matrix );
    traverse( node );
    _matrixStack.pop_back();
}
开发者ID:mp3butcher,项目名称:osgPhysics,代码行数:9,代码来源:ComputeTrianglesVisitor.cpp

示例3: apply

void GeometryDataCollector::apply( osg::Transform& transform )
{
    osg::Matrix matrix;
    if ( !matrixStack.empty() ) matrix = matrixStack.back();
    transform.computeLocalToWorldMatrix( matrix, this );

    pushMatrix( matrix );
    traverse( transform );
    popMatrix();
}
开发者ID:caomw,项目名称:osgPhysX,代码行数:10,代码来源:PhysicsUtil.cpp

示例4: traverse

void
BuildTopologyVisitor::apply(osg::Transform& xform)
{
    osg::Matrix matrix;
    if (!_matrixStack.empty()) matrix = _matrixStack.back();
    xform.computeLocalToWorldMatrix(matrix, this);
    _matrixStack.push_back(matrix);
    traverse(xform);
    _matrixStack.pop_back();
}
开发者ID:JD31,项目名称:osgearth,代码行数:10,代码来源:TopologyGraph.cpp

示例5: createOrReuseMatrix

void 
ProxyCullVisitor::apply(osg::Transform& node)
{
    //OE_INFO << "Transform!" << std::endl;

    if ( isCulledByProxyFrustum(node) )
        return;

    _cv->pushOntoNodePath( &node);

    _cv->pushCurrentMask();
    osg::StateSet* node_state = node.getStateSet();
    if (node_state) _cv->pushStateSet(node_state);

    // push the current proxy data:
    osg::Polytope savedF  = _proxyFrustum;
    osg::Matrix   savedMV = _proxyModelViewMatrix;

    // calculate the new proxy frustum:
    node.computeLocalToWorldMatrix(_proxyModelViewMatrix, this);
    _proxyFrustum.setAndTransformProvidingInverse( _proxyProjFrustum, _proxyModelViewMatrix );

    osg::ref_ptr<osg::RefMatrix> matrix = createOrReuseMatrix(*_cv->getModelViewMatrix());
    node.computeLocalToWorldMatrix(*matrix,this);
    _cv->pushModelViewMatrix(matrix.get(), node.getReferenceFrame());

    // traverse children:
    handle_cull_callbacks_and_traverse(node);

    // restore the previous proxy frustum and MVM
    _proxyFrustum         = savedF;
    _proxyModelViewMatrix = savedMV;

    _cv->popModelViewMatrix();
    if (node_state) _cv->popStateSet();
    _cv->popCurrentMask();

    _cv->popFromNodePath();
}
开发者ID:myemail2235,项目名称:osgearth,代码行数:39,代码来源:CullingUtils.cpp

示例6: apply

    void apply(osg::Transform& transform)
    {
        osg::Matrix matrix;
        if (!_matrixStack.empty()) matrix = _matrixStack.back();

        transform.computeLocalToWorldMatrix(matrix,this);

        pushMatrix(matrix);

        traverse(transform);

        popMatrix();
    }
开发者ID:philipdumont,项目名称:osgearth,代码行数:13,代码来源:osgearth_createtile.cpp

示例7: apply

void ComputeBoundingBoxVisitor::apply(osg::Transform& node)
{
    if(node.asMatrixTransform() || node.asPositionAttitudeTransform())
    {
        osg::Matrix prevMatrix = m_curMatrix;

        //m_curMatrix.preMult(node.asMatrixTransform()->getMatrix());
	node.computeLocalToWorldMatrix(m_curMatrix,this);

        traverse(node);

        m_curMatrix = prevMatrix;
    }
}
开发者ID:TheNumenorean,项目名称:calvr,代码行数:14,代码来源:ComputeBoundingBoxVisitor.cpp

示例8: apply

void ComputeCylinderVisitor::apply( osg::Transform & transform )
{
    osg::Matrix matrix;

    if( !stack.empty() )
    {
        matrix = stack.back();
    }

    transform.computeLocalToWorldMatrix( matrix, this );

    pushMatrix( matrix );

    traverse( transform );

    popMatrix();
}
开发者ID:AditGame,项目名称:Adit,代码行数:17,代码来源:ComputeCylinderVisitor.cpp

示例9: apply

void CollectOccludersVisitor::apply(osg::Transform &node)
{
    if (isCulled(node))
        return;

    // push the culling mode.
    pushCurrentMask();

    ref_ptr<osg::RefMatrix> matrix = createOrReuseMatrix(*getModelViewMatrix());
    node.computeLocalToWorldMatrix(*matrix, this);
    pushModelViewMatrix(matrix.get(), node.getReferenceFrame());

    handle_cull_callbacks_and_traverse(node);

    popModelViewMatrix();

    // pop the culling mode.
    popCurrentMask();
}
开发者ID:hyyh619,项目名称:OpenSceneGraph-3.4.0,代码行数:19,代码来源:CollectOccludersVisitor.cpp

示例10: apply

void IntersectionVisitor::apply(osg::Transform& transform)
{
    if (!enter(transform)) return;

    osg::ref_ptr<osg::RefMatrix> matrix = _modelStack.empty() ? new osg::RefMatrix() : new osg::RefMatrix(*_modelStack.back());
    transform.computeLocalToWorldMatrix(*matrix,this);

    pushModelMatrix(matrix.get());

    // now push an new intersector clone transform to the new local coordinates
    push_clone();

    traverse(transform);
    
    // pop the clone.
    pop_clone();
    
    popModelMatrix();

    // tidy up an cached cull variables in the current intersector.
    leave();
}
开发者ID:joevandyk,项目名称:osg,代码行数:22,代码来源:IntersectionVisitor.cpp

示例11: apply

void CVRCullVisitor::apply(osg::Transform& node)
{
    bool status = _cullingStatus;
    bool firstStatus = _firstCullStatus;

    if(isCulled(node))
    {
        _firstCullStatus = firstStatus;
        _cullingStatus = status;
        return;
    }

    // push the culling mode.
    pushCurrentMask();

    // push the node's state.
    StateSet* node_state = node.getStateSet();
    if(node_state)
        pushStateSet(node_state);

    ref_ptr<RefMatrix> matrix = createOrReuseMatrix(*getModelViewMatrix());
    node.computeLocalToWorldMatrix(*matrix,this);
    pushModelViewMatrix(matrix.get(),node.getReferenceFrame());

    handle_cull_callbacks_and_traverse(node);

    popModelViewMatrix();

    // pop the node's state off the render graph stack.    
    if(node_state)
        popStateSet();

    // pop the culling mode.
    popCurrentMask();

    _firstCullStatus = firstStatus;
    _cullingStatus = status;
}
开发者ID:megasha,项目名称:calvr,代码行数:38,代码来源:CVRCullVisitor.cpp

示例12: apply


//.........这里部分代码省略.........
        domAny *currentHPR = (domAny*)teq->add("CurrentHPR" );
        currentHPR->setValue(toString(dof->getCurrentHPR()).c_str());

        domAny *minTranslate = (domAny*)teq->add("MinTranslate" );
        minTranslate->setValue(toString(dof->getMinTranslate()).c_str());

        domAny *maxTranslate = (domAny*)teq->add("MaxTranslate" );
        maxTranslate->setValue(toString(dof->getMaxTranslate()).c_str());

        domAny *incrementTranslate = (domAny*)teq->add("IncrementTranslate" );
        incrementTranslate->setValue(toString(dof->getIncrementTranslate()).c_str());

        domAny *currentTranslate = (domAny*)teq->add("CurrentTranslate" );
        currentTranslate->setValue(toString(dof->getCurrentTranslate()).c_str());

        domAny *minScale = (domAny*)teq->add("MinScale" );
        minScale->setValue(toString(dof->getMinScale()).c_str());

        domAny *maxScale = (domAny*)teq->add("MaxScale" );
        maxScale->setValue(toString(dof->getMaxScale()).c_str());

        domAny *incrementScale = (domAny*)teq->add("IncrementScale" );
        incrementScale->setValue(toString(dof->getIncrementScale()).c_str());

        domAny *currentScale = (domAny*)teq->add("CurrentScale" );
        currentScale->setValue(toString(dof->getCurrentScale()).c_str());

        domAny *multOrder = (domAny*)teq->add("MultOrder" );
        multOrder->setValue(toString<int>(dof->getHPRMultOrder()).c_str());

        domAny *limitationFlags = (domAny*)teq->add("LimitationFlags" );
        limitationFlags->setValue(toString<unsigned long>(dof->getLimitationFlags()).c_str());

        domAny *animationOn = (domAny*)teq->add("AnimationOn" );
        animationOn->setValue(toString<bool>(dof->getAnimationOn()).c_str());

        domAny *putMatrix = (domAny*)teq->add("PutMatrix" );
        putMatrix->setValue(toString(dof->getPutMatrix()).c_str());

        currentNode->setId(getNodeName(node, "doftransform").c_str());
    }
    else
    {
        osgAnimation::Bone* bone = dynamic_cast<osgAnimation::Bone*>(&node);
        if (bone)
        {
            domNode *pDomNode = daeSafeCast< domNode >(currentNode->add( COLLADA_ELEMENT_NODE ));
            pDomNode->setType(NODETYPE_JOINT);
            pDomNode->setId(getNodeName(node, "bone").c_str());
        }
        else
        {
            std::string nodeName = getNodeName(node, "transform");
            currentNode->setId(nodeName.c_str());

            // Unknown transform type, just use local to world matrix
            osg::Matrix matrix;
            node.computeLocalToWorldMatrix(matrix, NULL);

            osg::Callback* ncb = node.getUpdateCallback();
            bool handled = false;
            if (ncb)
            {
                osgAnimation::UpdateMatrixTransform* ut = dynamic_cast<osgAnimation::UpdateMatrixTransform*>(ncb);
                // If targeted by an animation we split up the matrix into multiple place element so they can be targeted individually
                if (ut)
                {
                    handled = true;

                    // Note: though this is a generic matrix, based on the fact that it will be animated by and UpdateMatrixTransform,
                    // we assume the initial matrix can be decomposed into translation, rotation and scale elements
                    writeUpdateTransformElements(matrix.getTrans(), matrix.getRotate(), matrix.getScale());
                }
            }

            // If not targeted by an animation simply write a single matrix place element
            if (!handled)
            {
                domMatrix *mat = daeSafeCast< domMatrix >(currentNode->add( COLLADA_ELEMENT_MATRIX ) );
                nodeName += "_matrix";
                mat->setSid(nodeName.c_str());

                const osg::Matrix::value_type *mat_vals = matrix.ptr();
                for ( int i = 0; i < 4; i++ )
                {
                    for ( int j = 0; j < 4; j++ )
                    {
                        mat->getValue().append( mat_vals[i + j*4] );
                    }
                }
            }
        }
    }

    writeNodeExtra(node);

    lastDepth = _nodePath.size();

    traverse( node );
}
开发者ID:IsemanTech,项目名称:osg,代码行数:101,代码来源:daeWTransforms.cpp


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