]> git.mxchange.org Git - flightgear.git/commitdiff
Try to fix using an own cull visitor with osg 3.
authorMathias Froehlich <Mathias.Froehlich@web.de>
Thu, 28 Jul 2011 16:23:54 +0000 (18:23 +0200)
committerMathias Froehlich <Mathias.Froehlich@web.de>
Thu, 28 Jul 2011 16:23:54 +0000 (18:23 +0200)
src/Main/CameraGroup.cxx

index cb3f07d78498263817afb503e53979c8636485f9..78a27891b8bf781c42b894f133aa300905c280b0 100644 (file)
@@ -116,7 +116,22 @@ void installCullVisitor(Camera* camera)
         = static_cast<osgViewer::Renderer*>(camera->getRenderer());
     for (int i = 0; i < 2; ++i) {
         osgUtil::SceneView* sceneView = renderer->getSceneView(i);
+#if SG_OSG_VERSION_LESS_THAN(3,0,0)
+        sceneView->setCullVisitor(new simgear::EffectCullVisitor);
+#else
+        osg::ref_ptr<osgUtil::CullVisitor::Identifier> identifier;
+        identifier = sceneView->getCullVisitor()->getIdentifier();
         sceneView->setCullVisitor(new simgear::EffectCullVisitor);
+        sceneView->getCullVisitor()->setIdentifier(identifier.get());
+
+        identifier = sceneView->getCullVisitorLeft()->getIdentifier();
+        sceneView->setCullVisitorLeft(sceneView->getCullVisitor()->clone());
+        sceneView->getCullVisitorLeft()->setIdentifier(identifier.get());
+
+        identifier = sceneView->getCullVisitorRight()->getIdentifier();
+        sceneView->setCullVisitorRight(sceneView->getCullVisitor()->clone());
+        sceneView->getCullVisitorRight()->setIdentifier(identifier.get());
+#endif
     }
 }
 }
@@ -653,12 +668,12 @@ CameraInfo* CameraGroup::buildGUICamera(SGPropertyNode* cameraNode,
       // New style window declaration / definition
       window = wBuild->buildWindow(windowNode);
     }
-    
+
     if (!window) { // buildWindow can fail
       SG_LOG(SG_GENERAL, SG_WARN, "CameraGroup::buildGUICamera: failed to build a window");
       return NULL;
     }
-    
+
     Camera* camera = new Camera;
     camera->setAllowEventFocus(false);
     camera->setGraphicsContext(window->gc.get());
@@ -826,7 +841,7 @@ void warpGUIPointer(CameraGroup* cgroup, int x, int y)
         = dynamic_cast<GraphicsWindow*>(guiCamera->getGraphicsContext());
     if (!gw)
         return;
-    globals->get_renderer()->getEventHandler()->setMouseWarped();    
+    globals->get_renderer()->getEventHandler()->setMouseWarped();
     // Translate the warp request into the viewport of the GUI camera,
     // send the request to the window, then transform the coordinates
     // for the Viewer's event queue.