summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/RenderBase.cpp
diff options
context:
space:
mode:
authorRyan Houdek <Sonicadvance1@gmail.com>2014-11-28 11:45:38 -0600
committerRyan Houdek <Sonicadvance1@gmail.com>2014-11-28 11:45:38 -0600
commitce059769f6bf13118366f77fea926727efcf4510 (patch)
tree8ea7f2014f086f1df0f661697863c5b72d633a5b /Source/Core/VideoCommon/RenderBase.cpp
parent0e3d20c349ead263a630463beeb4335aaf512e42 (diff)
parent6d51455195e95a1bb97eb263fcd3423c757f59e7 (diff)
Merge pull request #1439 from Armada651/ogl-stereo-3d
OGL: Stereoscopic 3D Support
Diffstat (limited to 'Source/Core/VideoCommon/RenderBase.cpp')
-rw-r--r--Source/Core/VideoCommon/RenderBase.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/RenderBase.cpp b/Source/Core/VideoCommon/RenderBase.cpp
index d93d43f490..84c037c753 100644
--- a/Source/Core/VideoCommon/RenderBase.cpp
+++ b/Source/Core/VideoCommon/RenderBase.cpp
@@ -240,6 +240,42 @@ bool Renderer::CalculateTargetSize(unsigned int framebuffer_width, unsigned int
return false;
}
+void Renderer::ConvertStereoRectangle(const TargetRectangle& rc, TargetRectangle& leftRc, TargetRectangle& rightRc)
+{
+ // Resize target to half its original size
+ TargetRectangle drawRc = rc;
+ if (g_ActiveConfig.iStereoMode == STEREO_TAB)
+ {
+ // The height may be negative due to flipped rectangles
+ int height = rc.bottom - rc.top;
+ drawRc.top += height / 4;
+ drawRc.bottom -= height / 4;
+ }
+ else
+ {
+ int width = rc.right - rc.left;
+ drawRc.left += width / 4;
+ drawRc.right -= width / 4;
+ }
+
+ // Create two target rectangle offset to the sides of the backbuffer
+ leftRc = drawRc, rightRc = drawRc;
+ if (g_ActiveConfig.iStereoMode == STEREO_TAB)
+ {
+ leftRc.top -= s_backbuffer_height / 4;
+ leftRc.bottom -= s_backbuffer_height / 4;
+ rightRc.top += s_backbuffer_height / 4;
+ rightRc.bottom += s_backbuffer_height / 4;
+ }
+ else
+ {
+ leftRc.left -= s_backbuffer_width / 4;
+ leftRc.right -= s_backbuffer_width / 4;
+ rightRc.left += s_backbuffer_width / 4;
+ rightRc.right += s_backbuffer_width / 4;
+ }
+}
+
void Renderer::SetScreenshot(const std::string& filename)
{
std::lock_guard<std::mutex> lk(s_criticalScreenshot);