#include <osg\NodeVisitor>
#include <osg\MatrixTransform>
#include <osg\PagedLOD>
#include <osgDB\FileNameUtils>
#include <osg\Geode>
#include <strstream>

//只能处理osgExp插件导出的单个ive文件
class InsideLODVisitor : public osg::NodeVisitor
{
public:
InsideLODVisitor(float_rangeScale=50):rangeScale(_rangeScale),
osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN)
{
}
virtual void apply(osg::Geode& geode)
{
//检测是否处理过
if (markedGeode.find(&geode)!=markedGeode.end())
{
return;
}
//记录已经处理
markedGeode.insert(&geode);
//在geode的父节点和geode之间插入一个LOD节点
unsigned int parentNum=geode.getNumParents();
osg::Node::ParentList parents=geode.getParents();
for (osg::Node::ParentList::iterator itr =parents.begin(); itr<parents.end(); itr++)
{
osg::ref_ptr<osg::LOD> lod=new osg::LOD;
lod->addChild(&geode, 0, geode.getBound().radius()*rangeScale);
//osg::ref_ptr<osg::Geode> tmpGeode=dynamic_cast<osg::Geode*>(geode.clone(osg::CopyOp::DEEP_COPY_ALL));
//osgUtil::Simplifier simplifier(0.5);
//tmpGeode->accept(simplifier);
//lod->addChild(tmpGeode, geode.getBound().radius()*rangeScale, FLT_MAX);
(*itr)->replaceChild(&geode, lod);
}
}
private:
std::set<osg::Geode*> markedGeode;
float rangeScale;
};

最新文章

  1. ABP(现代ASP.NET样板开发框架)系列之1、ABP总体介绍
  2. 关于DataTable添加新列到指定列的方法
  3. [Android]电话拨号器开发
  4. 任务调度开源框架Quartz动态添加、修改和删除定时任务
  5. ORACLE 10G 闪回建议
  6. [ACM_模拟] The Willy Memorial Program (poj 1073 ,联通水管注水模拟)
  7. ios-点击图片放大,背景变半透明
  8. 在xargx命令中如何使用重定向
  9. ThinkPHP之中的getField、Find、select、返回数据类型详解(ThinkPHP之中所有数据读取了)
  10. Path Sum的变体
  11. 【POJ 3162】 Walking Race (树形DP-求树上最长路径问题,+单调队列)
  12. winform音频播放器(有声小说[凡人修仙传])
  13. Tess4J OCR简单使用教程
  14. WordPress在Centos下Apache设置伪静态方法
  15. ajax post 提交数据和文件
  16. virtualization - Ubuntu Budgie screen distortion in Hyper-V - Ask Ubuntu
  17. Win10一直弹出 用户账户控制 解决
  18. Docker for windows10 配置阿里云镜像
  19. TCC细读 - 3 恢复流程
  20. idea找不到import project

热门文章

  1. 【PHP面向对象(OOP)编程入门教程】1.什么是面向对象?
  2. Linux/CentOS 同步网络时间
  3. php curl 库使用
  4. Code First02---CodeFirst配置实体与数据库映射的两种方式
  5. 谈谈jQuery之绑定事件
  6. 线段树区间更新&amp;&amp;求和poj3486
  7. dp题目列表
  8. Python自动化之IO多路复用
  9. ubuntu下配置apache2多域名(apache2.4.6)
  10. Linux CAT与ECHO命令详解 &lt;&lt;EOF EOF