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");
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);
}
effective_visibility = effvis;
}
-
+void SGSky::set_clouds_enabled(bool enabled)
+{
+ if (enabled) {
+ cloud_root->setAllChildrenOn();
+ } else {
+ cloud_root->setAllChildrenOff();
+ }
+}
SGSharedPtr<SGStars> stars;
layer_list_type cloud_layers;
- osg::ref_ptr<osg::Group> pre_root, cloud_root;
- osg::ref_ptr<osg::Group> pre_transform;
+ osg::ref_ptr<osg::Group> pre_root, pre_transform;
+ osg::ref_ptr<osg::Switch> cloud_root;
osg::ref_ptr<osg::MatrixTransform> _ephTransform;
*/
void set_3dCloudWrap(bool wrap);
+ void set_clouds_enabled(bool enabled);
};
#endif // _SG_SKY_HXX