您的位置:首页 > 其它

15、osg中使用LOD设置当模型超过多少米,不显示模型

2015-12-16 22:19 531 查看
如下代码:

// fountain.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include <osgDB/Registry>
#include <osgDB/ReadFile>
#include <osgDB/ReaderWriter>
#include <osgDB/WriteFile>
#include <osg/Node>
#include <osgViewer/Viewer>
#include <osg/LOD>
int _tmain(int argc, _TCHAR* argv[])
{
osgViewer::Viewer viewer ;
//读取模型
osg::Node* node = osgDB::readNodeFile("fountain.osgt") ;
//LOD结点
osg::LOD * lod = new osg::LOD();
//添加结点并设置视矩
lod ->addChild (node,0,3000) ;
viewer.setSceneData(lod) ;
osgDB::writeNodeFile(*(viewer.getSceneData()), "free.osg", osgDB::Registry::instance() ->getOptions());
viewer.realize();
viewer.run();
return 0;
}
效果如下:



当上图使用鼠标使其缩小到一定程度就会消失
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: