本文通过代码的介绍,讲解在osgEarth中,由.earth文件到地球的创建流程,展现osgEarth中概念,如Map、Layer以及MapNode。
内容
osg::Node* node = MapNodeHelper().load(arguments, &viewer);
分析osgEarth中地球的创建,从如上代码开始,其中arguments变量为osg::ArgumentParser对象,其路径中包含一.earth文件,viewer为osgViewer::Viewer对象,上述代码中创建的osg::Node对象,可直接设置为viewer对象的场景节点,实现渲染,结果如下图所示:

接下来分析load函数的内容:
osg::ref_ptr<osg::Node> node = osgDB::readNodeFiles(args, myReadOptions.get());
// fallback in case none is specified:
if (!node.valid())
{
本文深入探讨osgEarth中如何将.earth文件转化为地球模型的创建过程,解析osgEarth的Map、Layer和MapNode概念。通过代码分析,展示了osgEarth的ReaderWriterOsgEarth类用于读取.earth文件,创建osgEarth::Map和MapNode,并利用EarthManipulator实现地球的3D渲染效果。
订阅专栏 解锁全文
607

被折叠的 条评论
为什么被折叠?



