Expose some OSG DisplaySettings to the property tree
This commit is contained in:
parent
aba57077fd
commit
1e43675f61
1 changed files with 85 additions and 0 deletions
|
@ -101,6 +101,80 @@ using namespace osg;
|
|||
static osg::ref_ptr<osgViewer::Viewer> viewer;
|
||||
static osg::ref_ptr<osg::Camera> mainCamera;
|
||||
|
||||
static void setStereoMode( const char * mode )
|
||||
{
|
||||
DisplaySettings::StereoMode stereoMode;
|
||||
bool stereoOn = true;
|
||||
|
||||
if (strcmp(mode,"QUAD_BUFFER")==0)
|
||||
{
|
||||
stereoMode = DisplaySettings::QUAD_BUFFER;
|
||||
}
|
||||
else if (strcmp(mode,"ANAGLYPHIC")==0)
|
||||
{
|
||||
stereoMode = DisplaySettings::ANAGLYPHIC;
|
||||
}
|
||||
else if (strcmp(mode,"HORIZONTAL_SPLIT")==0)
|
||||
{
|
||||
stereoMode = DisplaySettings::HORIZONTAL_SPLIT;
|
||||
}
|
||||
else if (strcmp(mode,"VERTICAL_SPLIT")==0)
|
||||
{
|
||||
stereoMode = DisplaySettings::VERTICAL_SPLIT;
|
||||
}
|
||||
else if (strcmp(mode,"LEFT_EYE")==0)
|
||||
{
|
||||
stereoMode = DisplaySettings::LEFT_EYE;
|
||||
}
|
||||
else if (strcmp(mode,"RIGHT_EYE")==0)
|
||||
{
|
||||
stereoMode = DisplaySettings::RIGHT_EYE;
|
||||
}
|
||||
else if (strcmp(mode,"HORIZONTAL_INTERLACE")==0)
|
||||
{
|
||||
stereoMode = DisplaySettings::HORIZONTAL_INTERLACE;
|
||||
}
|
||||
else if (strcmp(mode,"VERTICAL_INTERLACE")==0)
|
||||
{
|
||||
stereoMode = DisplaySettings::VERTICAL_INTERLACE;
|
||||
}
|
||||
else if (strcmp(mode,"CHECKERBOARD")==0)
|
||||
{
|
||||
stereoMode = DisplaySettings::CHECKERBOARD;
|
||||
} else {
|
||||
stereoOn = false;
|
||||
}
|
||||
DisplaySettings::instance()->setStereo( stereoOn );
|
||||
DisplaySettings::instance()->setStereoMode( stereoMode );
|
||||
}
|
||||
|
||||
static const char * getStereoMode()
|
||||
{
|
||||
DisplaySettings::StereoMode stereoMode = DisplaySettings::instance()->getStereoMode();
|
||||
bool stereoOn = DisplaySettings::instance()->getStereo();
|
||||
if( !stereoOn ) return "OFF";
|
||||
if( stereoMode == DisplaySettings::QUAD_BUFFER ) {
|
||||
return "QUAD_BUFFER";
|
||||
} else if( stereoMode == DisplaySettings::ANAGLYPHIC ) {
|
||||
return "ANAGLYPHIC";
|
||||
} else if( stereoMode == DisplaySettings::HORIZONTAL_SPLIT ) {
|
||||
return "HORIZONTAL_SPLIT";
|
||||
} else if( stereoMode == DisplaySettings::VERTICAL_SPLIT ) {
|
||||
return "VERTICAL_SPLIT";
|
||||
} else if( stereoMode == DisplaySettings::LEFT_EYE ) {
|
||||
return "LEFT_EYE";
|
||||
} else if( stereoMode == DisplaySettings::RIGHT_EYE ) {
|
||||
return "RIGHT_EYE";
|
||||
} else if( stereoMode == DisplaySettings::HORIZONTAL_INTERLACE ) {
|
||||
return "HORIZONTAL_INTERLACE";
|
||||
} else if( stereoMode == DisplaySettings::VERTICAL_INTERLACE ) {
|
||||
return "VERTICAL_INTERLACE";
|
||||
} else if( stereoMode == DisplaySettings::CHECKERBOARD ) {
|
||||
return "CHECKERBOARD";
|
||||
}
|
||||
return "OFF";
|
||||
}
|
||||
|
||||
void fgOSOpenWindow(bool stencil)
|
||||
{
|
||||
viewer = new osgViewer::Viewer;
|
||||
|
@ -175,8 +249,19 @@ void fgOSOpenWindow(bool stencil)
|
|||
viewer->setSceneData(new osg::Group);
|
||||
globals->get_renderer()->setViewer(viewer.get());
|
||||
CameraGroup::setDefault(cameraGroup);
|
||||
|
||||
DisplaySettings * displaySettings = DisplaySettings::instance();
|
||||
fgTie("/sim/rendering/osg-displaysettings/eye-separation", displaySettings, &DisplaySettings::getEyeSeparation, &DisplaySettings::setEyeSeparation );
|
||||
fgTie("/sim/rendering/osg-displaysettings/screen-distance", displaySettings, &DisplaySettings::getScreenDistance, &DisplaySettings::setScreenDistance );
|
||||
fgTie("/sim/rendering/osg-displaysettings/screen-width", displaySettings, &DisplaySettings::getScreenWidth, &DisplaySettings::setScreenWidth );
|
||||
fgTie("/sim/rendering/osg-displaysettings/screen-height", displaySettings, &DisplaySettings::getScreenHeight, &DisplaySettings::setScreenHeight );
|
||||
fgTie("/sim/rendering/osg-displaysettings/stereo-mode", getStereoMode, setStereoMode );
|
||||
fgTie("/sim/rendering/osg-displaysettings/double-buffer", displaySettings, &DisplaySettings::getDoubleBuffer, &DisplaySettings::setDoubleBuffer );
|
||||
fgTie("/sim/rendering/osg-displaysettings/depth-buffer", displaySettings, &DisplaySettings::getDepthBuffer, &DisplaySettings::setDepthBuffer );
|
||||
fgTie("/sim/rendering/osg-displaysettings/rgb", displaySettings, &DisplaySettings::getRGB, &DisplaySettings::setRGB );
|
||||
}
|
||||
|
||||
|
||||
static int status = 0;
|
||||
|
||||
void fgOSExit(int code)
|
||||
|
|
Loading…
Add table
Reference in a new issue