Refactored the support for stereo and keystone RTT setup so that it can be applied to an existing Camera.

This commit is contained in:
Robert Osfield
2013-05-20 19:24:34 +00:00
parent acb4ba8554
commit 455ebbc5f1
8 changed files with 134 additions and 252 deletions

View File

@@ -21,6 +21,7 @@
#include <osgDB/Registry>
#include <osgDB/ReadFile>
#include <osgDB/WriteFile>
#include <osgGA/TrackballManipulator>
#include <osgViewer/Viewer>
@@ -300,6 +301,9 @@ bool Viewer::readConfiguration(const std::string& filename)
{
OSG_NOTICE<<"Using osgViewer::Config : "<<config->className()<<std::endl;
config->configure(*this);
osgDB::writeObjectFile(*config,"test.osgt");
return true;
}
@@ -468,29 +472,13 @@ void Viewer::realize()
if (screenNum>=0) setUpViewInWindow(x, y, width, height, screenNum);
else setUpViewInWindow(x,y,width,height);
}
else if (screenNum>=0)
{
setUpViewOnSingleScreen(screenNum);
}
else
{
osg::DisplaySettings* ds = _displaySettings.valid() ? _displaySettings.get() : osg::DisplaySettings::instance().get();
if (ds->getKeystoneHint() && !ds->getKeystoneFileNames().empty()) osgViewer::Keystone::loadKeystoneFiles(ds);
bool useKeystones = ds->getKeystoneHint() && !ds->getKeystones().empty();
if (ds->getStereo() && (!ds->getUseSceneViewForStereoHint() || useKeystones))
{
setUpViewForStereo();
}
else if (useKeystones)
{
osgViewer::Keystone* keystone = dynamic_cast<osgViewer::Keystone*>(ds->getKeystones().front().get());
setUpViewForKeystone(keystone);
}
else if (screenNum>=0)
{
setUpViewOnSingleScreen(screenNum);
}
else
{
setUpViewAcrossAllScreens();
}
setUpViewAcrossAllScreens();
}
}