]> git.mxchange.org Git - simgear.git/blobdiff - simgear/scene/sky/sky.cxx
Added some OSG headers for the correct evaluation of the OSG_VERSION_LESS_THAN macro.
[simgear.git] / simgear / scene / sky / sky.cxx
index ed7b13e05df2d1c2ff3d3fb8ab815750809b1e96..389d8bf42d5392a80478aa95036c9f13e3c44e39 100644 (file)
@@ -58,7 +58,7 @@ SGSky::SGSky( void ) {
     preStateSet->setAttribute(new osg::Depth(osg::Depth::LESS, 0.0, 1.0,
                                              false));
     pre_root->setStateSet(preStateSet);
-    cloud_root = new osg::Group;
+    cloud_root = new osg::Switch;
     cloud_root->setNodeMask(simgear::MODEL_BIT);
     cloud_root->setName("SGSky-cloud-root");
 
@@ -79,9 +79,12 @@ SGSky::~SGSky( void )
 
 // initialize the sky and connect the components to the scene graph at
 // the provided branch
-void SGSky::build( double h_radius_m, double v_radius_m,
-                   double sun_size, double moon_size,
-                   const SGEphemeris& eph, SGPropertyNode *property_tree_node,
+void SGSky::build( double h_radius_m,
+                   double v_radius_m,
+                   double sun_size,
+                   double moon_size,
+                   const SGEphemeris& eph,
+                   SGPropertyNode *property_tree_node,
                    simgear::SGReaderWriterOptions* options )
 {
     dome = new SGSkyDome;
@@ -195,7 +198,7 @@ void
 SGSky::add_cloud_layer( SGCloudLayer * layer )
 {
     cloud_layers.push_back(layer);
-    cloud_root->addChild(layer->getNode());
+    cloud_root->addChild(layer->getNode(), true);
 
     layer->set_enable3dClouds(clouds_3d_enabled);
 }
@@ -293,7 +296,7 @@ void SGSky::set_3dCloudUseImpostors(bool imp)
     SGCloudField::setUseImpostors(imp);
 }
 
-void SGSky::texture_path( const string& path ) {
+void SGSky::texture_path( const std::string& path ) {
        tex_path = SGPath( path );
 }
 
@@ -426,4 +429,11 @@ void SGSky::modify_vis( float alt, float time_factor ) {
     effective_visibility = effvis;
 }
 
-
+void SGSky::set_clouds_enabled(bool enabled)
+{
+    if (enabled) {
+        cloud_root->setAllChildrenOn();
+    } else {
+        cloud_root->setAllChildrenOff();
+    }
+}