Skip to content

Commit 834ae19

Browse files
committed
Add sky to globe
1 parent ed2e7d7 commit 834ae19

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/plugins/globe/globe_plugin.cpp

+12-2
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,14 @@
5252
#include <osgEarth/Map>
5353
#include <osgEarth/MapNode>
5454
#include <osgEarth/TileSource>
55+
#include <osgEarthUtil/SkyNode>
5556
#include <osgEarthUtil/AutoClipPlaneHandler>
5657
#include <osgEarthDrivers/gdal/GDALOptions>
5758
#include <osgEarthDrivers/tms/TMSOptions>
5859

5960
using namespace osgEarth::Drivers;
6061
using namespace osgEarth::Util::Controls21;
62+
using namespace osgEarth::Util;
6163

6264
#define MOVE_OFFSET 0.05
6365

@@ -231,9 +233,9 @@ void GlobePlugin::run()
231233
mIsGlobeRunning = true;
232234
setupProxy();
233235

234-
if ( getenv( "MAPXML" ) )
236+
if ( getenv( "GLOBE_MAPXML" ) )
235237
{
236-
char* mapxml = getenv( "MAPXML" );
238+
char* mapxml = getenv( "GLOBE_MAPXML" );
237239
QgsDebugMsg( mapxml );
238240
osg::Node* node = osgDB::readNodeFile( mapxml );
239241
if ( !node )
@@ -250,6 +252,14 @@ void GlobePlugin::run()
250252
setupMap();
251253
}
252254

255+
if ( getenv( "GLOBE_SKY" ) ) {
256+
SkyNode* sky = new SkyNode( mMapNode->getMap() );
257+
sky->setDateTime( 2011, 1, 6, 17.0 );
258+
//sky->setSunPosition( osg::Vec3(0,-1,0) );
259+
sky->attach( mOsgViewer );
260+
mRootNode->addChild( sky );
261+
}
262+
253263
// create a surface to house the controls
254264
mControlCanvas = ControlCanvas::get( mOsgViewer );
255265
mRootNode->addChild( mControlCanvas );

0 commit comments

Comments
 (0)