From 1ee2af9f4182f877304e5de214732b3cc44a6eb1 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 16 Jan 2007 16:01:01 +0000 Subject: [PATCH] Further work on CompositeViewer --- examples/osgcamera/osgcamera.cpp | 9 ++++++++- include/osgViewer/View | 2 ++ include/osgViewer/Viewer | 1 - src/osgViewer/CompositeViewer.cpp | 6 +++--- src/osgViewer/View.cpp | 26 +++++++++++++++++--------- src/osgViewer/Viewer.cpp | 14 -------------- 6 files changed, 30 insertions(+), 28 deletions(-) diff --git a/examples/osgcamera/osgcamera.cpp b/examples/osgcamera/osgcamera.cpp index 3b9bb2599..2139dbee1 100644 --- a/examples/osgcamera/osgcamera.cpp +++ b/examples/osgcamera/osgcamera.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -251,9 +252,15 @@ int main( int argc, char **argv ) while (arguments.read("-1")) { singleWindowMultipleCameras(viewer); } while (arguments.read("-2")) { multipleWindowMultipleCameras(viewer); } - +#if 0 if (apm.valid()) viewer.setCameraManipulator(apm.get()); else viewer.setCameraManipulator( new osgGA::TrackballManipulator() ); +#else + + viewer.setCameraManipulator( new osgGA::FlightManipulator() ); + +#endif + #if 0 diff --git a/include/osgViewer/View b/include/osgViewer/View index 731ec3603..ace67ae79 100644 --- a/include/osgViewer/View +++ b/include/osgViewer/View @@ -98,9 +98,11 @@ class OSGVIEWER_EXPORT View : public osg::View, public osgGA::GUIActionAdapter public: void assignSceneDataToCameras(); + void init(); protected: + virtual ~View(); osg::ref_ptr _scene; diff --git a/include/osgViewer/Viewer b/include/osgViewer/Viewer index 59358c537..ff66e8380 100644 --- a/include/osgViewer/Viewer +++ b/include/osgViewer/Viewer @@ -129,7 +129,6 @@ class OSGVIEWER_EXPORT Viewer : public osgViewer::View protected: - void init(); void checkWindowStatus(); bool _firstFrame; diff --git a/src/osgViewer/CompositeViewer.cpp b/src/osgViewer/CompositeViewer.cpp index c4c8a5d2c..714dde9e2 100644 --- a/src/osgViewer/CompositeViewer.cpp +++ b/src/osgViewer/CompositeViewer.cpp @@ -44,7 +44,7 @@ CompositeViewer::CompositeViewer(): CompositeViewer::~CompositeViewer() { - osg::notify(osg::NOTICE)<<"CompositeViewer::~CompositeViewer()"<close(); } - osg::notify(osg::NOTICE)<<"finish CompositeViewer::~CompsiteViewer()"<init(); + (*itr)->init(); } } diff --git a/src/osgViewer/View.cpp b/src/osgViewer/View.cpp index 71511fd2a..85e3efa71 100644 --- a/src/osgViewer/View.cpp +++ b/src/osgViewer/View.cpp @@ -35,6 +35,19 @@ View::~View() // osg::notify(osg::NOTICE)<<"Destructing osgViewer::View"< initEvent = _eventQueue->createEvent(); + initEvent->setEventType(osgGA::GUIEventAdapter::FRAME); + + if (_cameraManipulator.valid()) + { + _cameraManipulator->init(*initEvent, *this); + } +} + void View::setSceneData(osg::Node* node) { _scene = new osgViewer::Scene; @@ -312,8 +325,7 @@ void View::requestContinuousUpdate(bool) void View::requestWarpPointer(float x,float y) { - osg::notify(osg::NOTICE)<<"View::requestWarpPointer("<getCurrentEventState(); bool view_invert_y = eventState->getMouseYOrientation()==osgGA::GUIEventAdapter::Y_INCREASING_DOWNWARDS; + + osg::notify(osg::INFO)<<"View::getCameraContainingPosition("< initEvent = _eventQueue->createEvent(); - initEvent->setEventType(osgGA::GUIEventAdapter::FRAME); - - if (_cameraManipulator.valid()) - { - _cameraManipulator->init(*initEvent, *this); - } -} - void Viewer::getContexts(Contexts& contexts, bool onlyValid) { typedef std::set ContextSet;