# include <config.h>
#endif
+#include <osg/Matrix>
#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
#include <simgear/compiler.h>
-#include SG_GLUT_H
-
+#if defined( __APPLE__)
+# include <GLUT/glut.h>
+#else
+# include <GL/glut.h>
+#endif
#include <plib/pu.h>
#include <Scenery/scenery.hxx>
#include "renderer.hxx"
#include "fg_props.hxx"
#include "WindowSystemAdapter.hxx"
+#include "CameraGroup.hxx"
using namespace flightgear;
//
static osg::ref_ptr<osgViewer::Viewer> viewer;
-static osg::ref_ptr<osg::Camera> mainCamera;
static osg::ref_ptr<osgViewer::GraphicsWindowEmbedded> gw;
static int GlutModifiers = 0;
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);
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();
-}