• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ osg::PagedLOD类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: Stringify

void
ShaderGenerator::apply(osg::PagedLOD& node)
{
    if ( !_active )
        return;

    bool ignore;
    if ( node.getUserValue(SHADERGEN_HINT_IGNORE, ignore) && ignore )
        return;

    for( unsigned i=0; i<node.getNumFileNames(); ++i )
    {
        static Threading::Mutex s_mutex;
        s_mutex.lock();
        const std::string& filename = node.getFileName( i );
        if (!filename.empty() && 
            osgDB::getLowerCaseFileExtension(filename).compare(SHADERGEN_PL_EXTENSION) != 0 )
        {
            node.setFileName( i, Stringify() << filename << "." << SHADERGEN_PL_EXTENSION );
        }
        s_mutex.unlock();
    }

    apply( static_cast<osg::LOD&>(node) );
}
开发者ID:ToninoTarsi,项目名称:osgearth,代码行数:25,代码来源:ShaderGenerator.cpp


示例2: Stringify

void
ShaderGenerator::apply(osg::PagedLOD& node)
{
    if ( !_active ) return;

    for( unsigned i=0; i<node.getNumFileNames(); ++i )
    {
        const std::string& filename = node.getFileName( i );
        if (!filename.empty() && 
            osgDB::getLowerCaseFileExtension(filename).compare(SHADERGEN_PL_EXTENSION) != 0 )
        {
            node.setFileName( i, Stringify() << filename << "." << SHADERGEN_PL_EXTENSION );
        }
    }

    apply( static_cast<osg::LOD&>(node) );
}
开发者ID:dsallen,项目名称:osgearth,代码行数:17,代码来源:ShaderGenerator.cpp


示例3: apply

 virtual void apply(osg::PagedLOD& node)
 {        
     //The PagedLOD node will contain two filenames, the first is empty and is the actual geometry of the          
     //tile and the second is the filename of the next tile.
     if (node.getNumFileNames() > 1)
     {
         //Get the child filename
         const std::string &filename = node.getFileName(1);              
         if (osgEarth::Registry::instance()->isBlacklisted(filename))
         {
             //If the tile is blacklisted, we set the actual geometry, child 0, to always display
             //and the second child to never display
             node.setRange(0, 0, FLT_MAX);
             node.setRange(1, FLT_MAX, FLT_MAX);
         }
         else
         {
             //If the child is not blacklisted, it is possible that it could have been blacklisted previously so reset the
             //ranges of both the first and second children.  This gives the second child another
             //chance to be traversed in case a layer was added that might have data.
             osg::ref_ptr< MapNode::TileRangeData > ranges = static_cast< MapNode::TileRangeData* >(node.getUserData());
             if (ranges)
             {
                 node.setRange(0, ranges->_minRange, ranges->_maxRange);
                 node.setRange(1, 0, ranges->_minRange);
             }                  
         }
         
     }
     traverse(node);
 }
开发者ID:ender35,项目名称:osgearth,代码行数:31,代码来源:MapNode.cpp


示例4: apply

void PosterVisitor::apply(osg::PagedLOD &node)
{
    if (!hasCullCallback(node.getCullCallback(), g_pagedCullingCallback.get()))
    {
        for (unsigned int i = 0; i < node.getNumFileNames(); ++i)
        {
            if (node.getFileName(i).empty())
                continue;

            PagedNodeNameSet::iterator itr = _pagedNodeNames.find(node.getFileName(i));
            if (itr != _pagedNodeNames.end())
            {
                node.addCullCallback(g_pagedCullingCallback.get());
                _appliedCount++;
            }

            break;
        }
    }
    else if (!_addingCallbacks)
    {
        node.removeCullCallback(g_pagedCullingCallback.get());
        if (_appliedCount > 0)
            _appliedCount--;
    }

    traverse(node);
}
开发者ID:hyyh619,项目名称:OpenSceneGraph-3.4.0,代码行数:28,代码来源:PosterPrinter.cpp


示例5: apply

    void apply(osg::PagedLOD& plod)
    {
        if (s_ExitApplication) return;

        ++_currentLevel;

        initBound();

        // first compute the bounds of this subgraph
        for(unsigned int i=0; i<plod.getNumFileNames(); ++i)
        {
            if (plod.getFileName(i).empty())
            {
                traverse(plod);
            }
        }

        if (intersects())
        {
            for(unsigned int i=0; i<plod.getNumFileNames(); ++i)
            {
                osg::notify(osg::INFO)<<"   filename["<<i<<"] "<<plod.getFileName(i)<<std::endl;
                if (!plod.getFileName(i).empty())
                {
                    std::string filename;
                    if (!plod.getDatabasePath().empty())
                    {
                        filename = plod.getDatabasePath() + plod.getFileName(i);
                    }
                    else
                    {
                        filename = plod.getFileName(i);
                    }


                    osg::ref_ptr<osg::Node> node = readNodeFileAndWriteToCache(filename);

                    if (!s_ExitApplication && node.valid()) node->accept(*this);
                }
            }
        }

        --_currentLevel;
    }
开发者ID:toothing,项目名称:osg,代码行数:44,代码来源:osgfilecache.cpp


示例6: pushStateSet

void
CountsVisitor::apply(osg::PagedLOD& node)
{
    pushStateSet(node.getStateSet());

    osg::Group* grp = node.getParent(0);
    osg::Group* gPar = NULL;
    if (grp)
        gPar = grp->getParent(0);
    apply(node.getStateSet());

    _pagedLods++;
    osg::ref_ptr<osg::Object> rp = (osg::Object*)&node;
    _uPagedLods.insert(rp);
    _totalChildren += node.getNumChildren();

    if (++_depth > _maxDepth)
        _maxDepth = _depth;
    traverse((osg::Node&)node);
    _depth--;

    popStateSet();
}
开发者ID:lemonrong,项目名称:osg3DViewer,代码行数:23,代码来源:CountsVisitor.cpp


示例7: apply

void IntersectionVisitor::apply(osg::PagedLOD& plod)
{
    if (!enter(plod)) return;

    if (plod.getNumFileNames()>0)
    {
#if 1
        // Identify the range value for the highest res child
        float targetRangeValue;
        if( plod.getRangeMode() == osg::LOD::DISTANCE_FROM_EYE_POINT )
            targetRangeValue = 1e6; // Init high to find min value
        else
            targetRangeValue = 0; // Init low to find max value
            
        const osg::LOD::RangeList rl = plod.getRangeList();
        osg::LOD::RangeList::const_iterator rit;
        for( rit = rl.begin();
             rit != rl.end();
             rit++ )
        {
            if( plod.getRangeMode() == osg::LOD::DISTANCE_FROM_EYE_POINT )
            {
                if( rit->first < targetRangeValue )
                    targetRangeValue = rit->first;
            }
            else
            {
                if( rit->first > targetRangeValue )
                    targetRangeValue = rit->first;
            }
        }

        // Perform an intersection test only on children that display
        // at the maximum resolution.
        unsigned int childIndex;
        for( rit = rl.begin(), childIndex = 0;
             rit != rl.end();
             rit++, childIndex++ )
        {
            if( rit->first != targetRangeValue )
                // This is not one of the highest res children
                continue;

            osg::ref_ptr<osg::Node> child( NULL );
            if( plod.getNumChildren() > childIndex )
                child = plod.getChild( childIndex );

            if( (!child.valid()) && (_readCallback.valid()) )
            {
                // Child is NULL; attempt to load it, if we have a readCallback...
                unsigned int validIndex( childIndex );
                if (plod.getNumFileNames() <= childIndex)
                    validIndex = plod.getNumFileNames()-1;

                child = _readCallback->readNodeFile( plod.getDatabasePath() + plod.getFileName( validIndex ) );
            }

            if ( !child.valid() && plod.getNumChildren()>0)
            {
                // Child is still NULL, so just use the one at the end of the list.
                child = plod.getChild( plod.getNumChildren()-1 );
            }

            if (child.valid())
            {
                child->accept(*this);
            }
        }
#else    
        // older code than above block, that assumes that the PagedLOD is ordered correctly
        // i.e. low res children first, no duplicate ranges.
        
        osg::ref_ptr<osg::Node> highestResChild;

        if (plod.getNumFileNames() != plod.getNumChildren() && _readCallback.valid())
        {
            highestResChild = _readCallback->readNodeFile( plod.getDatabasePath() + plod.getFileName(plod.getNumFileNames()-1) );
        }
        
        if ( !highestResChild.valid() && plod.getNumChildren()>0)
        {
            highestResChild = plod.getChild( plod.getNumChildren()-1 );
        }

        if (highestResChild.valid())
        {
            highestResChild->accept(*this);
        }
#endif
    }

    leave();
}
开发者ID:joevandyk,项目名称:osg,代码行数:93,代码来源:IntersectionVisitor.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ osg::Parameters类代码示例发布时间:2022-05-31
下一篇:
C++ osg::NodeVisitor类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap