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


C++ LOD::getRangeList方法代码示例

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


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

示例1: writeRangeList

static bool writeRangeList( osgDB::OutputStream& os, const osg::LOD& node )
{
    const osg::LOD::RangeList& ranges = node.getRangeList();
    os.writeSize(ranges.size()); os << os.BEGIN_BRACKET << std::endl;
    for ( osg::LOD::RangeList::const_iterator itr=ranges.begin();
          itr!=ranges.end(); ++itr )
    {
        os << itr->first << itr->second << std::endl;
    }
    os << os.END_BRACKET << std::endl;
    return true;
}
开发者ID:151706061,项目名称:OpenSceneGraph,代码行数:12,代码来源:LOD.cpp

示例2: apply

		void apply(osg::LOD& lod)
		{
			// find the highest LOD:
			int   minIndex = 0;
			float minRange = FLT_MAX;
			for(unsigned i=0; i<lod.getNumRanges(); ++i)
			{
				if ( lod.getRangeList()[i].first < minRange )
				{
					minRange = lod.getRangeList()[i].first;
					minIndex = i;
				}
			}

			//remove all but the highest:
			osg::ref_ptr<osg::Node> highestLOD = lod.getChild( minIndex );
			lod.removeChildren( 0, lod.getNumChildren() );

			//add it back with a full range.
			lod.addChild( highestLOD.get(), 0.0f, FLT_MAX );

			traverse(lod);
		}
开发者ID:whztt07,项目名称:osgVegetation,代码行数:23,代码来源:MRTShaderInstancing.cpp

示例3: apply

void daeWriter::apply( osg::LOD &node )
{
    debugPrint( node );
    updateCurrentDaeNode();
    lastDepth = _nodePath.size();
    currentNode = daeSafeCast< domNode >(currentNode->add( COLLADA_ELEMENT_NODE ) );
    currentNode->setId(getNodeName(node,"LOD").c_str());

    if (writeExtras)
    {
        // Store LOD data as extra "LOD" data in the "OpenSceneGraph" technique
        // Adds the following to a node

        //<extra type="LOD">
        //    <technique profile="OpenSceneGraph">
        //        <Center>1 2 3</Center> (optional )
        //        <Radius>-1</Radius> (required if Center is available)
        //        <RangeMode>0</RangeMode>
        //        <RangeList>
        //            <MinMax>0 300</MinMax>
        //            <MinMax>300 600</MinMax>
        //        </RangeList>
        //    </technique>
        //</extra>

        domExtra *extra = daeSafeCast<domExtra>(currentNode->add( COLLADA_ELEMENT_EXTRA ));
        extra->setType("LOD");
        domTechnique *teq = daeSafeCast<domTechnique>(extra->add( COLLADA_ELEMENT_TECHNIQUE ) );
        teq->setProfile( "OpenSceneGraph" );

        if (node.getCenterMode()==osg::LOD::USER_DEFINED_CENTER)
        {
            domAny *center = (domAny*)teq->add("Center");
            center->setValue(toString(node.getCenter()).c_str());

            domAny *radius = (domAny*)teq->add("Radius");
            radius->setValue(toString<osg::LOD::value_type>(node.getRadius()).c_str());
        }

        domAny *rangeMode = (domAny*)teq->add("RangeMode");
        rangeMode->setValue(toString<osg::LOD::RangeMode>(node.getRangeMode()).c_str());

        domAny *valueLists = (domAny*)teq->add("RangeList");

        unsigned int pos = 0;
        const osg::LOD::RangeList& rangelist = node.getRangeList();
        for(osg::LOD::RangeList::const_iterator sitr=rangelist.begin();
            sitr!=rangelist.end();
            ++sitr,++pos)
        {
            domAny *valueList = (domAny*)valueLists->add("MinMax");
            std::stringstream fw;
            fw << sitr->first << " " << sitr->second;
            valueList->setValue(fw.str().c_str());
        }
    }
        
    writeNodeExtra(node);

    // Process all children
    traverse( node );
}
开发者ID:aalex,项目名称:osg,代码行数:62,代码来源:daeWSceneObjects.cpp


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