跟进代码。 首先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> tagsosg::Node* node =...
跟进代码。 首先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> tagsosg::Node* node =...
创建osgViewer--->创建MapNode--->设置Earth操作器--->设置场景参数--->run MapNode是继承自osg的Node,是osgEarth中地球节点,你所添加的影像,DEM,模型都包含在MapNode中,因为它们都加入到Map中,Map则类似二维中的Map可以添加各种图层。剩余的不管是模型节点Node,或者是标注Node,还是其他的都是可以直接添加到Map...
osgEarth::initialize(); //create a viewer osgViewer::Viewer viewer ; viewer.setUpViewInWindow(0, 100, 800, 600); // ? why viewer.setReleaseContextAtEndOfFrameHint(false); //set camera manipulator viewer.setCameraManipulator(new EarthManipulator); // Map is datamodel for collection of laye...
在OsgEarth27程序目录中,找到运行程序"IxEarthViewer.exe"文件所在目录(例如:C:\OsgEarth27\Bin\ReleaseWin32),如下图所示。运行程序文件 复制"IxEarthViewer.exe"文件所在目录路径,这样可以方便在命令窗口中快速粘贴目录位置,然后输入"IxEarthViewer.exe ../map.earth"命令,如下图所示。输入命令 执行命令...
osgViewerd.lib osgTextd.lib (4)新建cpp文件中输入以下代码: 测试结果: 注意:如果调试时显示计算机中丢失osg130-osgDBd.dll就重启电脑(对的 就是这样) 注:如果提示缺少zlib.dll,这两个dll均可以在OSG依赖的第三方库3rdParty文件夹中可以找到,注意x86与x64选择,将这两个dll拷贝至OSG的bin目录(你加入环境变量...
这段代码首先包含了必要的头文件,然后创建了一个Viewer对象。通过调用Viewer的setSceneData方法,并传入osgDB::readNodeFile函数的结果,我们可以加载并设置场景数据。最后,调用Viewer的run方法开始渲染和显示场景。在这个例子中,我们假设存在一个名为"tree.osg"的场景文件,它包含了构建场景所需的各种节点和属性。4 ...
osgViewer::Viewer viewer; viewer.setSceneData(mapNode); osg::ref_ptr< osgEarth::Util::EarthManipulator> mainManipulator = new osgEarth::Util::EarthManipulator; viewer.setCameraManipulator(mainManipulator); viewer.setUpViewInWindow(100, 100, 800, 600); ...
#include<Windows.h>#include<iostream>#include<string>#include<osgViewer/Viewer>#include<osgDB/ReadFile>#include<osgEarth/MapNode>#include<osgEarth/ImageLayer>#include<osgEarthDrivers/gdal/GDALOptions>#include<osgEarthDrivers/cache_filesystem/FileSystemCache>#include<osgEarthDrivers/feature_ogr/OGRFeatur...
在osgEarth学习笔记的第三部分,我们将学习如何在项目中显示一个MBTiles图层。首先,我们需要包含所有必需的头文件。接着,我们将创建一个viewer对象,并设定窗口大小和特性。为了优化性能,我们设置viewer在每一帧结束时释放上下文的提示。然后,我们设置camera manipulator,并创建一个Map对象作为层的集合。为...