X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FMain%2Ffg_os.cxx;h=dfce9b2aaad59e61957e7b334271683764f90d6d;hb=49030e700ba276d5cd6ffa4f4e661a266fa0105c;hp=3aec6ab7fa3eac6ee0ccad31419942b0f3ea1368;hpb=580ebf637b991bbc5bb6b9632e8e62845d23ea43;p=flightgear.git diff --git a/src/Main/fg_os.cxx b/src/Main/fg_os.cxx index 3aec6ab7f..dfce9b2aa 100644 --- a/src/Main/fg_os.cxx +++ b/src/Main/fg_os.cxx @@ -7,13 +7,17 @@ # include #endif +#include #include #include #include -#include SG_GLUT_H - +#if defined( __APPLE__) +# include +#else +# include +#endif #include #include @@ -22,6 +26,7 @@ #include "renderer.hxx" #include "fg_props.hxx" #include "WindowSystemAdapter.hxx" +#include "CameraGroup.hxx" using namespace flightgear; @@ -31,7 +36,6 @@ using namespace flightgear; // static osg::ref_ptr viewer; -static osg::ref_ptr mainCamera; static osg::ref_ptr gw; static int GlutModifiers = 0; @@ -271,16 +275,17 @@ void fgOSOpenWindow(bool stencil) viewer->setDatabasePager(FGScenery::getPagerSingleton()); // now the main camera ... osg::Camera* camera = new osg::Camera; - mainCamera = camera; // If a viewport isn't set on the camera, then it's hard to dig it // out of the SceneView objects in the viewer, and the coordinates // of mouse events are somewhat bizzare. camera->setViewport(new osg::Viewport(0, 0, realw, realh)); camera->setProjectionResizePolicy(osg::Camera::FIXED); - Camera3D* cam3D = wsa->registerCamera3D(window, camera, string("main")); - cam3D->flags |= Camera3D::MASTER; - // Add as a slave for compatibility with the non-embedded osgViewer. - viewer->addSlave(camera); + CameraGroup* cgroup = new CameraGroup(viewer.get()); + cgroup->addCamera(CameraGroup::DO_INTERSECTION_TEST, camera, + osg::Matrixd::identity(), osg::Matrixd::identity(), + true); + cgroup->buildGUICamera(0, window); + CameraGroup::setDefault(cgroup); viewer->setCameraManipulator(globals->get_renderer()->getManipulator()); // Let FG handle the escape key with a confirmation viewer->setKeyEventSetsDone(0); @@ -292,18 +297,3 @@ void fgOSOpenWindow(bool stencil) viewer->setSceneData(new osg::Group); globals->get_renderer()->setViewer(viewer.get()); } - -bool fgOSIsMainCamera(const osg::Camera*) -{ - return true; -} - -bool fgOSIsMainContext(const osg::GraphicsContext*) -{ - return true; -} - -osg::GraphicsContext* fgOSGetMainContext() -{ - return gw.get(); -}