]> git.mxchange.org Git - flightgear.git/blobdiff - src/Viewer/CameraGroup.cxx
Prepare and implement reinit methods for instruments
[flightgear.git] / src / Viewer / CameraGroup.cxx
index 7603287f88e1b3f66d22700f232b25865e7e6dff..3d84717e5b8316e85c737c33e30afe337c8c6b97 100644 (file)
@@ -216,8 +216,8 @@ void CameraInfo::updateCameras()
 
 void CameraInfo::resized(double w, double h)
 {
-       if (w == 1.0 && h == 1.0)
-               return;
+    if (w == 1.0 && h == 1.0)
+        return;
 
     bufferSize->set( osg::Vec2f( w, h ) );
 
@@ -1087,6 +1087,18 @@ void CameraGroup::setCameraCullMasks(Node::NodeMask nm)
             camera = info->getCamera( GEOMETRY_CAMERA );
             if (camera == 0) continue;
             camera->setCullMask( nm & ~simgear::MODELLIGHT_BIT );
+
+            camera = info->getCamera( LIGHTING_CAMERA );
+            if (camera == 0) continue;
+            osg::Switch* sw = camera->getChild(0)->asSwitch();
+            for (unsigned int i = 0; i < sw->getNumChildren(); ++i) {
+                osg::Camera* lc = dynamic_cast<osg::Camera*>(sw->getChild(i));
+                if (lc == 0) continue;
+                string name = lc->getName();
+                if (name == "LightCamera") {
+                    lc->setCullMask( (nm & simgear::LIGHTS_BITS) | (lc->getCullMask() & ~simgear::LIGHTS_BITS) );
+                }
+            }
         }
     }
 }