From fe49a97baa973c891f40dce66aca3581347a9fd7 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 20 Mar 2003 17:00:32 +0000 Subject: [PATCH] Updates to osgProducer and osgstereoimage for stereo support. Changed the default distance from the scene of the home position of the trackball and flight manipulators. --- examples/osgstereoimage/osgstereoimage.cpp | 5 +++++ src/osgGA/FlightManipulator.cpp | 2 +- src/osgGA/TrackballManipulator.cpp | 2 +- src/osgProducer/OsgCameraGroup.cpp | 1 + src/osgProducer/Viewer.cpp | 2 +- 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/examples/osgstereoimage/osgstereoimage.cpp b/examples/osgstereoimage/osgstereoimage.cpp index 54e2b5db4..f2207d7b3 100644 --- a/examples/osgstereoimage/osgstereoimage.cpp +++ b/examples/osgstereoimage/osgstereoimage.cpp @@ -100,6 +100,11 @@ int main( int argc, char **argv ) // set the scene to render viewer.setSceneData(rootNode.get()); + // set up the use of stereo by default. + osg::DisplaySettings* ds = viewer.getDisplaySettings(); + if (!ds) ds = osg::DisplaySettings::instance(); + if (ds) ds->setStereo(true); + // create the windows and run the threads. viewer.realize(Producer::CameraGroup::ThreadPerCamera); diff --git a/src/osgGA/FlightManipulator.cpp b/src/osgGA/FlightManipulator.cpp index 2c78dad77..74c22d97d 100644 --- a/src/osgGA/FlightManipulator.cpp +++ b/src/osgGA/FlightManipulator.cpp @@ -50,7 +50,7 @@ void FlightManipulator::home(const GUIEventAdapter& ea,GUIActionAdapter& us) const osg::BoundingSphere& boundingSphere=_node->getBound(); _camera->setLookAt( - boundingSphere._center+osg::Vec3( 0.0,-3.0f * boundingSphere._radius,0.0f), + boundingSphere._center+osg::Vec3( 0.0,-3.5f * boundingSphere._radius,0.0f), boundingSphere._center, osg::Vec3(0.0f,0.0f,1.0f)); diff --git a/src/osgGA/TrackballManipulator.cpp b/src/osgGA/TrackballManipulator.cpp index c55830e4c..b498f99b3 100644 --- a/src/osgGA/TrackballManipulator.cpp +++ b/src/osgGA/TrackballManipulator.cpp @@ -50,7 +50,7 @@ void TrackballManipulator::home(const GUIEventAdapter& ,GUIActionAdapter& us) const osg::BoundingSphere& boundingSphere=_node->getBound(); - _camera->setView(boundingSphere._center+osg::Vec3( 0.0,-3.0f * boundingSphere._radius,0.0f), + _camera->setView(boundingSphere._center+osg::Vec3( 0.0,-3.5f * boundingSphere._radius,0.0f), boundingSphere._center, osg::Vec3(0.0f,0.0f,1.0f)); diff --git a/src/osgProducer/OsgCameraGroup.cpp b/src/osgProducer/OsgCameraGroup.cpp index 22374ec69..a3c68133f 100644 --- a/src/osgProducer/OsgCameraGroup.cpp +++ b/src/osgProducer/OsgCameraGroup.cpp @@ -269,6 +269,7 @@ void OsgCameraGroup::realize( ThreadingModel thread_model) // set up the visual chooser. if (_ds.valid() || numMultiSamples!=0) { + Producer::VisualChooser* rs_vc = rs->getVisualChooser(); if (!rs_vc) { diff --git a/src/osgProducer/Viewer.cpp b/src/osgProducer/Viewer.cpp index 0149f5ae9..176399f40 100644 --- a/src/osgProducer/Viewer.cpp +++ b/src/osgProducer/Viewer.cpp @@ -205,8 +205,8 @@ void Viewer::realize( ThreadingModel thread_model) for(SceneHandlerList::iterator p=_shvec.begin(); p!=_shvec.end(); p++ ) { (*p)->getState()->setAbortRenderingPtr(&_done); + (*p)->setCamera(_old_style_osg_camera.get()); } - OsgCameraGroup::sync(); }