Side By Side Letterbox Display mode (#1255)

* Added SBSLETTERBOX to menudef.txt

* Changed PresentSideBySide in gl_renderer

Needed for new side-by-side mode

* Added VR_SIDEBYSIDELETTERBOX to gl_stereo3d.cpp

For side by side letterbox display mode

* Added VR_SIDEBYSIDELETTERBOX to hw_modes.h

For new side by side letterbox display mode

* Added VR_SIDEBYSIDELETTERBOX to hw_vrmodes.cpp

For Side By Side Letterbox display mode
This commit is contained in:
William E. Waterman 2021-01-13 07:09:13 -05:00 committed by GitHub
parent 476e59fbab
commit 3261eb3643
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 56 additions and 18 deletions

View file

@ -90,7 +90,7 @@ private:
bool QuadStereoCheckInitialRenderContextState();
void PresentAnaglyph(bool r, bool g, bool b);
void PresentSideBySide();
void PresentSideBySide(int);
void PresentTopBottom();
void prepareInterleavedPresent(FPresentShaderBase& shader);
void PresentColumnInterleaved();

View file

@ -76,25 +76,59 @@ void FGLRenderer::PresentAnaglyph(bool r, bool g, bool b)
//
//==========================================================================
void FGLRenderer::PresentSideBySide()
void FGLRenderer::PresentSideBySide(int vrmode)
{
mBuffers->BindOutputFB();
ClearBorders();
if (vrmode == VR_SIDEBYSIDEFULL || vrmode == VR_SIDEBYSIDESQUISHED)
{
mBuffers->BindOutputFB();
ClearBorders();
// Compute screen regions to use for left and right eye views
int leftWidth = screen->mOutputLetterbox.width / 2;
int rightWidth = screen->mOutputLetterbox.width - leftWidth;
IntRect leftHalfScreen = screen->mOutputLetterbox;
leftHalfScreen.width = leftWidth;
IntRect rightHalfScreen = screen->mOutputLetterbox;
rightHalfScreen.width = rightWidth;
rightHalfScreen.left += leftWidth;
// Compute screen regions to use for left and right eye views
int leftWidth = screen->mOutputLetterbox.width / 2;
int rightWidth = screen->mOutputLetterbox.width - leftWidth;
IntRect leftHalfScreen = screen->mOutputLetterbox;
leftHalfScreen.width = leftWidth;
IntRect rightHalfScreen = screen->mOutputLetterbox;
rightHalfScreen.width = rightWidth;
rightHalfScreen.left += leftWidth;
mBuffers->BindEyeTexture(0, 0);
DrawPresentTexture(leftHalfScreen, true);
mBuffers->BindEyeTexture(0, 0);
DrawPresentTexture(leftHalfScreen, true);
mBuffers->BindEyeTexture(1, 0);
DrawPresentTexture(rightHalfScreen, true);
mBuffers->BindEyeTexture(1, 0);
DrawPresentTexture(rightHalfScreen, true);
}
else if (vrmode == VR_SIDEBYSIDELETTERBOX)
{
mBuffers->BindOutputFB();
screen->mOutputLetterbox.top = screen->mOutputLetterbox.height;
ClearBorders();
screen->mOutputLetterbox.top = 0; //reset so screenshots can be taken
// Compute screen regions to use for left and right eye views
int leftWidth = screen->mOutputLetterbox.width / 2;
int rightWidth = screen->mOutputLetterbox.width - leftWidth;
//cut letterbox height in half
int height = screen->mOutputLetterbox.height / 2;
int top = height * .5;
IntRect leftHalfScreen = screen->mOutputLetterbox;
leftHalfScreen.width = leftWidth;
leftHalfScreen.height = height;
leftHalfScreen.top = top;
IntRect rightHalfScreen = screen->mOutputLetterbox;
rightHalfScreen.width = rightWidth;
rightHalfScreen.left += leftWidth;
//give it those cinematic black bars on top and bottom
rightHalfScreen.height = height;
rightHalfScreen.top = top;
mBuffers->BindEyeTexture(0, 0);
DrawPresentTexture(leftHalfScreen, true);
mBuffers->BindEyeTexture(1, 0);
DrawPresentTexture(rightHalfScreen, true);
}
}
@ -360,7 +394,8 @@ void FGLRenderer::PresentStereo()
case VR_SIDEBYSIDEFULL:
case VR_SIDEBYSIDESQUISHED:
PresentSideBySide();
case VR_SIDEBYSIDELETTERBOX:
PresentSideBySide(vr_mode);
break;
case VR_TOPBOTTOM:
@ -385,4 +420,4 @@ void FGLRenderer::PresentStereo()
}
}
}
}

View file

@ -73,6 +73,7 @@ const VRMode *VRMode::GetVRMode(bool toscreen)
case VR_REDCYAN:
case VR_QUADSTEREO:
case VR_AMBERBLUE:
case VR_SIDEBYSIDELETTERBOX:
return &vrmi_stereo;
case VR_SIDEBYSIDESQUISHED:

View file

@ -14,6 +14,7 @@ enum
VR_LEFTEYEVIEW = 5,
VR_RIGHTEYEVIEW = 6,
VR_QUADSTEREO = 7,
VR_SIDEBYSIDELETTERBOX = 8,
VR_AMBERBLUE = 9,
VR_TOPBOTTOM = 11,
VR_ROWINTERLEAVED = 12,

View file

@ -2547,6 +2547,7 @@ OptionValue VRMode
9, "$OPTVAL_AMBERBLUE"
3, "$OPTVAL_SBSFULL"
4, "$OPTVAL_SBSNARROW"
8, "$OPTVAL_SBSLETTERBOX"
11, "$OPTVAL_TOPBOTTOM"
12, "$OPTVAL_ROWINTERLEAVED"
13, "$OPTVAL_COLUMNINTERLEAVED"