Adjustments to the horizontal and vertical split stereo code for better
handling of aspect ratio.
This commit is contained in:
@@ -88,10 +88,10 @@ void DisplaySettings::setDefaults()
|
||||
_screenHeight = 0.26f;
|
||||
|
||||
_splitStereoHorizontalEyeMapping = LEFT_EYE_LEFT_VIEWPORT;
|
||||
_splitStereoHorizontalSeparation = 42;
|
||||
_splitStereoHorizontalSeparation = 0;
|
||||
|
||||
_splitStereoVerticalEyeMapping = LEFT_EYE_TOP_VIEWPORT;
|
||||
_splitStereoVerticalSeparation = 42;
|
||||
_splitStereoVerticalSeparation = 0;
|
||||
|
||||
_doubleBuffer = true;
|
||||
_RGB = true;
|
||||
|
||||
@@ -305,6 +305,7 @@ void SceneView::cull()
|
||||
(*projection));
|
||||
|
||||
|
||||
|
||||
osg::ref_ptr<osg::RefMatrix> modelviewLeft = new osg::RefMatrix( (*modelview) *
|
||||
osg::Matrix(1.0f,0.0f,0.0f,0.0f,
|
||||
0.0f,1.0f,0.0f,0.0f,
|
||||
@@ -328,6 +329,21 @@ void SceneView::cull()
|
||||
0.0f,0.0f,1.0f,0.0f,
|
||||
-es,0.0f,0.0f,1.0f));
|
||||
|
||||
switch(_displaySettings->getStereoMode())
|
||||
{
|
||||
case(osg::DisplaySettings::HORIZONTAL_SPLIT):
|
||||
(*projectionLeft).postMult(osg::Matrix::scale(2.0f,1.0f,1.0f));
|
||||
(*projectionRight).postMult(osg::Matrix::scale(2.0f,1.0f,1.0f));
|
||||
break;
|
||||
case(osg::DisplaySettings::VERTICAL_SPLIT):
|
||||
(*projectionLeft).postMult(osg::Matrix::scale(1.0f,2.0f,1.0f));
|
||||
(*projectionRight).postMult(osg::Matrix::scale(1.0f,2.0f,1.0f));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
_cullVisitorRight->setTraversalMask(_cullMaskRight);
|
||||
cullStage(projectionRight.get(),modelviewRight.get(),_cullVisitorRight.get(),_rendergraphRight.get(),_renderStageRight.get());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user