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

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

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

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



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

示例1: readUserCenter

static bool readUserCenter( osgDB::InputStream& is, osg::LOD& node )
{
    osg::Vec3d center; double radius;
    is >> center >> radius;
    node.setCenter( center ); node.setRadius( radius );
    return true;
}
开发者ID:151706061,项目名称:OpenSceneGraph,代码行数:7,代码来源:LOD.cpp


示例2: apply

void StatsVisitor::apply(osg::LOD& node)
{
    if (node.getStateSet())
    {
        apply(*node.getStateSet());
    }

    ++_numInstancedLOD;
    _lodSet.insert(&node);

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


示例3: apply

void CVRCullVisitor::apply(osg::LOD& 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);

    handle_cull_callbacks_and_traverse(node);

    // 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,代码行数:32,代码来源:CVRCullVisitor.cpp


示例4: guard

void
FltExportVisitor::apply( osg::LOD& lodNode )
{
    _firstNode = false;
    ScopedStatePushPop guard( this, lodNode.getStateSet() );

    // LOD center - same for all children
    osg::Vec3d center = lodNode.getCenter();

    // Iterate children of the LOD and write a separate LOD record for each,
    // with that child's individual switchIn and switchOut properties
    for ( size_t i = 0; i < lodNode.getNumChildren(); ++i )
    {
        osg::Node* lodChild = lodNode.getChild(i);

        // Switch-in/switch-out distances may vary per child
        double switchInDist = lodNode.getMaxRange(i);
        double switchOutDist = lodNode.getMinRange(i);

        writeLevelOfDetail( lodNode, center, switchInDist, switchOutDist);
        writeMatrix( lodNode.getUserData() );
        writeComment( lodNode );

        // Traverse each child of the LOD
        writePushTraverseWritePop( *lodChild );
    }

}
开发者ID:joevandyk,项目名称:osg,代码行数:28,代码来源:FltExportVisitor.cpp


示例5: pushStateSet

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

    _lods++;
    osg::ref_ptr<osg::Object> rp = (osg::Object*)&node;
    _uLods.insert(rp);
    _totalChildren += node.getNumChildren();
    apply(node.getStateSet());

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

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


示例6: 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


示例7: readRangeList

static bool readRangeList( osgDB::InputStream& is, osg::LOD& node )
{
    unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET;
    for ( unsigned int i=0; i<size; ++i )
    {
        float min, max;
        is >> min >> max;
        node.setRange( i, min, max );
    }
    is >> is.END_BRACKET;
    return true;
}
开发者ID:151706061,项目名称:OpenSceneGraph,代码行数:12,代码来源:LOD.cpp


示例8: id

void
FltExportVisitor::writeLevelOfDetail(const osg::LOD &lod,
                                     osg::Vec3d const &center,
                                     double switchInDist,
                                     double switchOutDist)
{
    uint16   length(80);
    IdHelper id(*this, lod.getName());

    _records->writeInt16((int16) LOD_OP);
    _records->writeInt16(length);
    _records->writeID(id);
    _records->writeInt32(0);                   // 'Reserved' field
    _records->writeFloat64(switchInDist);
    _records->writeFloat64(switchOutDist);     // Switch-out distance
    _records->writeInt16(0);                   // Special Effect ID1
    _records->writeInt16(0);                   // Special Effect ID2
    _records->writeInt32(0);                   // Flags
    _records->writeFloat64(center.x());
    _records->writeFloat64(center.y());
    _records->writeFloat64(center.z());
    _records->writeFloat64(0);                 // Transition range
    _records->writeFloat64(0);                 // Significant size
}
开发者ID:hyyh619,项目名称:OpenSceneGraph-3.4.0,代码行数:24,代码来源:expPrimaryRecords.cpp


示例9: 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


示例10: checkUserCenter

// _userDefinedCenter, _radius
static bool checkUserCenter( const osg::LOD& node )
{
    return (node.getCenterMode()==osg::LOD::USER_DEFINED_CENTER)||(node.getCenterMode()==osg::LOD::UNION_OF_BOUNDING_SPHERE_AND_USER_DEFINED);
}
开发者ID:151706061,项目名称:OpenSceneGraph,代码行数:5,代码来源:LOD.cpp


示例11: checkRangeList

// _rangeList
static bool checkRangeList( const osg::LOD& node )
{
    return node.getNumRanges()>0;
}
开发者ID:151706061,项目名称:OpenSceneGraph,代码行数:5,代码来源:LOD.cpp


示例12: writeUserCenter

static bool writeUserCenter( osgDB::OutputStream& os, const osg::LOD& node )
{
    os << osg::Vec3d(node.getCenter()) << (double)node.getRadius() << std::endl;
    return true;
}
开发者ID:151706061,项目名称:OpenSceneGraph,代码行数:5,代码来源:LOD.cpp


示例13: debugPrint

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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ osg::Matrix类代码示例发布时间:2022-05-31
下一篇:
C++ osg::Image类代码示例发布时间: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