Added to Viewer::realize() automatic setup using Keystone when available and enabled, and when no other window setup has been selected.
This commit is contained in:
parent
9402efe38e
commit
4e34cadee2
@ -100,7 +100,7 @@ int main( int argc, char **argv )
|
||||
|
||||
if (ds->getStereo())
|
||||
{
|
||||
viewer.setUpViewForStereo(ds);
|
||||
viewer.setUpViewForStereo();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -263,7 +263,7 @@ class OSGVIEWER_EXPORT View : public osg::View, public osgGA::GUIActionAdapter
|
||||
osg::Camera* assignRenderToTextureCamera(osg::GraphicsContext* gc, int width, int height, osg::Texture* texture);
|
||||
osg::Camera* assignKeystoneDistortionCamera(osg::DisplaySettings* ds, osg::GraphicsContext* gc, int x, int y, int width, int height, GLenum buffer, osg::Texture* texture, Keystone* keystone);
|
||||
osg::Camera* assignStereoCamera(osg::DisplaySettings* ds, osg::GraphicsContext* gc, int x, int y, int width, int height, GLenum buffer, double eyeScale);
|
||||
void setUpViewForStereo(osg::DisplaySettings* ds);
|
||||
void setUpViewForStereo();
|
||||
void setUpViewForKeystone(Keystone* keystone);
|
||||
|
||||
struct StereoSlaveCallback : public osg::View::Slave::UpdateSlaveCallback
|
||||
|
@ -2490,8 +2490,9 @@ static const GLubyte patternCheckerboard[] = {
|
||||
0xAA, 0xAA, 0xAA, 0xAA};
|
||||
|
||||
|
||||
void View::setUpViewForStereo(osg::DisplaySettings* ds)
|
||||
void View::setUpViewForStereo()
|
||||
{
|
||||
osg::DisplaySettings* ds = _displaySettings.valid() ? _displaySettings.get() : osg::DisplaySettings::instance().get();
|
||||
if (!ds->getStereo()) return;
|
||||
|
||||
ds->setUseSceneViewForStereoHint(false);
|
||||
|
@ -464,13 +464,29 @@ 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
|
||||
{
|
||||
setUpViewAcrossAllScreens();
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user