Permalink
Browse files

Refactored the support for stereo and keystone RTT setup so that it c…

…an be applied to an existing Camera.
  • Loading branch information...
1 parent 80f750b commit bf6a0c569bf34792340c7f99131ad52fd96ec630 @osg-training-guest osg-training-guest committed May 20, 2013
@@ -31,6 +31,7 @@
#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
#include <osgViewer/config/SingleWindow>
+#include <osgViewer/config/SingleScreen>
#include <osgViewer/config/WoWVxDisplay>
@@ -74,7 +75,8 @@ int main( int argc, char **argv )
{
OSG_NOTICE<<" keystone filename = "<<*itr<<std::endl;
}
-
+
+ ds->setKeystoneHint(true);
if (!ds->getKeystoneFileNames().empty())
{
@@ -88,30 +90,14 @@ int main( int argc, char **argv )
std::string filename;
keystone->getUserValue("filename",filename);
OSG_NOTICE<<"Loaded keystone "<<filename<<", "<<keystone<<std::endl;
+
+ ds->getKeystones().push_back(keystone);
}
}
}
- osgViewer::Keystone::loadKeystoneFiles(ds);
+ viewer.apply(new osgViewer::SingleScreen(0));
- if (!ds->getKeystoneHint())
- {
- OSG_NOTICE<<"Keystone disabled"<<std::endl;
- }
-
- if (ds->getStereo())
- {
- viewer.setUpViewForStereo();
- }
- else
- {
- osg::ref_ptr<osgViewer::Keystone> keystone = 0;
- if (!(ds->getKeystones().empty())) keystone = dynamic_cast<osgViewer::Keystone*>(ds->getKeystones().front().get());
- if (!keystone) keystone = new osgViewer::Keystone;
-
- viewer.setUpViewForKeystone(keystone.get());
- }
-
viewer.realize();
while(!viewer.done())
View
@@ -289,8 +289,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();
- void setUpViewForKeystone(Keystone* keystone);
+ void assignStereoOrKeystoneToCamera(osg::Camera* camera, osg::DisplaySettings* ds);
struct StereoSlaveCallback : public osg::View::Slave::UpdateSlaveCallback
{
@@ -23,9 +23,9 @@ class OSGVIEWER_EXPORT SingleWindow : public ViewConfig
{
public:
- SingleWindow():_x(0),_y(0),_width(-1),_height(-1),_screenNum(0),_border(true),_overrideRedirect(false) {}
- SingleWindow(int x, int y, int width, int height, unsigned int screenNum=0):_x(x),_y(y),_width(width),_height(height),_screenNum(screenNum),_border(true),_overrideRedirect(false) {}
- SingleWindow(const SingleWindow& rhs, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY):ViewConfig(rhs,copyop), _x(rhs._x),_y(rhs._y),_width(rhs._width),_height(rhs._height),_screenNum(rhs._screenNum),_border(rhs._border), _overrideRedirect(rhs._overrideRedirect) {}
+ SingleWindow():_x(0),_y(0),_width(-1),_height(-1),_screenNum(0),_windowDecoration(true),_overrideRedirect(false) {}
+ SingleWindow(int x, int y, int width, int height, unsigned int screenNum=0):_x(x),_y(y),_width(width),_height(height),_screenNum(screenNum),_windowDecoration(true),_overrideRedirect(false) {}
+ SingleWindow(const SingleWindow& rhs, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY):ViewConfig(rhs,copyop), _x(rhs._x),_y(rhs._y),_width(rhs._width),_height(rhs._height),_screenNum(rhs._screenNum),_windowDecoration(rhs._windowDecoration), _overrideRedirect(rhs._overrideRedirect) {}
META_Object(osgViewer,SingleWindow);
@@ -46,8 +46,8 @@ class OSGVIEWER_EXPORT SingleWindow : public ViewConfig
void setScreenNum(unsigned int sn) { _screenNum = sn; }
unsigned int getScreenNum() const { return _screenNum; }
- void setBorder(bool border) { _border = border; }
- bool getBorder() const { return _border; }
+ void setWindowDecoration(bool wd) { _windowDecoration = wd; }
+ bool getWindowDecoration() const { return _windowDecoration; }
void setOverrideRedirect(bool override) { _overrideRedirect = override; }
bool getOverrideRedirect() const { return _overrideRedirect; }
@@ -56,7 +56,7 @@ class OSGVIEWER_EXPORT SingleWindow : public ViewConfig
int _x, _y, _width, _height;
unsigned int _screenNum;
- bool _border;
+ bool _windowDecoration;
bool _overrideRedirect;
};
Oops, something went wrong.

0 comments on commit bf6a0c5

Please sign in to comment.