首页 > 其他 > 详细

[原][osgearth]osgearthviewer读取earth文件,代码解析(earth文件读取的一帧)

时间:2017-02-09 17:21:24      阅读:1556      评论:0      收藏:0      [点我收藏+]

跑osgearthviewer程序

使用一个earth文件做参数传入

跟进代码。

首先osgearthviewer程序加载earth的方式分为两种:

 

1.根据earth文件(load方式)

2.使用SDK加载(create方式)

 

我们使用earth文件是load方式,直接看load函数,定位到这个位置

    // load an earth file, and support all or our example command-line options
    // and earth file <external> tags    
    osg::Node* node = MapNodeHelper().load(arguments, &viewer);

层层跟进,一直到ExampleResources.cpp的271行

  osg::ref_ptr<osgDB::Options> myReadOptions = Registry::cloneOrCreateOptions(readOptions);
    //readoptions是空的
    Config c;
    c.add("elevation_smoothing", false);
    TerrainOptions to(c);

    MapNodeOptions defMNO;
    defMNO.setTerrainOptions( to );

    myReadOptions->setPluginStringData("osgEarth.defaultOptions", defMNO.getConfig().toJSON());

    // read in the Earth file:
    osg::Node* node = osgDB::readNodeFiles(args, myReadOptions.get());

  

这里发现它要读取earth文件是在osgDB内部,但使用的方式定义的osgDB::Options

 

[原][osgearth]osgearthviewer读取earth文件,代码解析(earth文件读取的一帧)

原文:http://www.cnblogs.com/lyggqm/p/6383013.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!