跑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