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


C++ CameraParameters::computeScreenProjectionRect方法代码示例

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


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

示例1: compute

// sorted list - rendering queue order
// sorted list of refferences according to the screen size
//  - analyze only second one
//  - remove skip field from the Struct
void OrderEstimator::compute(
            RenderNodeVec&    renderNodes,
            NodeIdPosVec&     desiredIds,
     const  GPUCacheManager&  gpuManager,
     const  VolumeTreeBase&   tree,
     const  Box_f&            bb,
     const  CameraParameters& cp,
     const  uint32_t          nodesMax,
     const  uint32_t          tfHist,
     const  float             msMax,
     const  uint8_t           maxTreeDepth,
     const  bool              frontToBack,
            bool              useRenderingError,
     const  uint16_t          renderingError  )
{
    renderNodes.resize( 0 );
    desiredIds.resize(  0 );

    // Check if buget is allocated
    if( nodesMax < 1 )
    {
        LBWARN << "budget is zero" << std::endl;
        return;
    }

    // Check if tree is initialized
    const uint32_t rootNodePos = 0;
    const NodeId   rootNodeId = tree.getNodeId( rootNodePos );
    if( tree.getSize() < 1 || rootNodeId < 1 )
    {
        LBWARN << "octree is not initialized" << std::endl;
        return;
    }

    const VolumeTreeTensorErrors* treeErr = dynamic_cast< const VolumeTreeTensorErrors* >(&tree);
    if( !treeErr )
        useRenderingError = false;

    byte rank = _getRank( _tensorPrms->getRank(0), useRenderingError, renderingError, 0, treeErr );

    // Check if root node is loaded
    if( !gpuManager.hasNodeOnGPU( rootNodeId ))
    {
        // always keep root node loaded
        desiredIds.push_back( NodeIdPos( rootNodeId, rootNodePos, rank ));
        return;
    }

    // Initialize rendering queue with the root node and
    // then try to expand it
    RenderNode rNode;
    rNode.nodeId        = rootNodeId;
    rNode.coords        = _getFloatDataPos( tree );
    rNode.treePos       = rootNodePos;
    rNode.treeLevel     = 1;
    rNode.screenRect    = cp.computeScreenProjectionRect( rNode.coords );
    rNode.screenRectSquare = rNode.screenRect.getAreaSize();
    rNode.screenSize    = rNode.screenRect.getDiagonalSize();
    rNode.renderingTime = _estimateRenderingTime( rNode.screenSize );
    rNode.rank          = rank;
    rNode.fullyVsible   = cp.computeVisibility( rNode.coords ) == vmml::VISIBILITY_FULL;

    std::list<RenderNode> renderList;
    std::vector<RenderNodeListIt> renderHeap;

    renderList.push_front( rNode );
    renderHeap.push_back( renderList.begin() );

    std::make_heap( renderHeap.begin(), renderHeap.end(), RenderNodeListItCmp );

    uint32_t nodesUsed = 1;
    float    timeUsed  = rNode.renderingTime;

    // blocks to render stay in renderList, if expansion is desired but
    // not yet possible (data is not on GPU) corresponding requests are 
    // copied to desiredIds array.
    RenderNode childrenNodes[8];
    Box_f      quads[8];
    OctreeChildrenOrder childrenOrder;
    bool expanded = true;

    while( expanded && nodesUsed+8 < nodesMax && timeUsed < msMax )
    {
        expanded = false;
        while( renderHeap.size() > 0 )
        {
            const RenderNode* current = &(*renderHeap.front());

            if( current->treeLevel >= maxTreeDepth )
            {
                pop_heap( renderHeap.begin(), renderHeap.end(), RenderNodeListItCmp ); renderHeap.pop_back();
                continue;
            }

            if( !tree.hasVisibleData( current->treePos, tfHist ))
            {
//.........这里部分代码省略.........
开发者ID:rballester,项目名称:Livre,代码行数:101,代码来源:orderEstimator.cpp


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