diff --git a/src/common/rendering/gl/gl_renderer.h b/src/common/rendering/gl/gl_renderer.h index c75927c0f..3a4c55a70 100644 --- a/src/common/rendering/gl/gl_renderer.h +++ b/src/common/rendering/gl/gl_renderer.h @@ -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(); diff --git a/src/common/rendering/gl/gl_stereo3d.cpp b/src/common/rendering/gl/gl_stereo3d.cpp index 032fb71ad..c81a8e66a 100644 --- a/src/common/rendering/gl/gl_stereo3d.cpp +++ b/src/common/rendering/gl/gl_stereo3d.cpp @@ -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() } } -} \ No newline at end of file +} diff --git a/src/common/rendering/hwrenderer/data/hw_vrmodes.cpp b/src/common/rendering/hwrenderer/data/hw_vrmodes.cpp index bde88b5a7..caf11f947 100644 --- a/src/common/rendering/hwrenderer/data/hw_vrmodes.cpp +++ b/src/common/rendering/hwrenderer/data/hw_vrmodes.cpp @@ -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: diff --git a/src/common/rendering/hwrenderer/data/hw_vrmodes.h b/src/common/rendering/hwrenderer/data/hw_vrmodes.h index a80ecaf57..26c9fd211 100644 --- a/src/common/rendering/hwrenderer/data/hw_vrmodes.h +++ b/src/common/rendering/hwrenderer/data/hw_vrmodes.h @@ -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, diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index b2c5e58e5..b87fa1274 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -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"