summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorJules Blok <jules.blok@gmail.com>2014-10-31 16:05:44 +0100
committerJules Blok <jules.blok@gmail.com>2014-11-23 14:27:39 +0100
commit1261bd02caa0ca2503bdd52e7b37c22f8e0bcde5 (patch)
treebe38205c35d5341f8380ae60328e810b335b516c /Source/Core
parentc3ad6e78207bc0f64a9687fd8f27fbe0f7606bc7 (diff)
VertexShaderManager: Add stereoscopy options to swap the left and right eye.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/DolphinWX/VideoConfigDiag.cpp3
-rw-r--r--Source/Core/VideoCommon/VertexShaderManager.cpp4
-rw-r--r--Source/Core/VideoCommon/VideoConfig.cpp3
-rw-r--r--Source/Core/VideoCommon/VideoConfig.h1
4 files changed, 9 insertions, 2 deletions
diff --git a/Source/Core/DolphinWX/VideoConfigDiag.cpp b/Source/Core/DolphinWX/VideoConfigDiag.cpp
index 9b8b70b5d5..78be8c208e 100644
--- a/Source/Core/DolphinWX/VideoConfigDiag.cpp
+++ b/Source/Core/DolphinWX/VideoConfigDiag.cpp
@@ -152,6 +152,7 @@ static wxString shader_errors_desc = wxTRANSLATE("Usually if shader compilation
static wxString stereo_3d_desc = wxTRANSLATE("Side-by-side stereoscopic 3D.");
static wxString stereo_separation_desc = wxTRANSLATE("Control the Interpupillary distance.");
static wxString stereo_focal_desc = wxTRANSLATE("Control the distance at which objects appear to be at screen depth.");
+static wxString stereo_swap_desc = wxTRANSLATE("Swap the left and right eye.\n\nIf unsure, leave this unchecked.");
#if !defined(__APPLE__)
@@ -470,6 +471,8 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
szr_stereo->Add(new wxStaticText(page_enh, wxID_ANY, _("Focal Length:")), 1, wxALIGN_CENTER_VERTICAL, 0);
szr_stereo->Add(foc_slider, 1, wxEXPAND | wxRIGHT);
+ szr_stereo->Add(CreateCheckBox(page_enh, _("Swap eyes"), wxGetTranslation(stereo_swap_desc), vconfig.bStereoSwapEyes));
+
wxStaticBoxSizer* const group_stereo = new wxStaticBoxSizer(wxVERTICAL, page_enh, _("Stereoscopy"));
group_stereo->Add(szr_stereo, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
szr_enh_main->Add(group_stereo, 0, wxEXPAND | wxALL, 5);
diff --git a/Source/Core/VideoCommon/VertexShaderManager.cpp b/Source/Core/VideoCommon/VertexShaderManager.cpp
index ad69ba4362..150bd783a8 100644
--- a/Source/Core/VideoCommon/VertexShaderManager.cpp
+++ b/Source/Core/VideoCommon/VertexShaderManager.cpp
@@ -516,8 +516,8 @@ void VertexShaderManager::SetConstants()
if (g_ActiveConfig.iStereoMode > 0 && xfmem.projection.type == GX_PERSPECTIVE)
{
float offset = g_ActiveConfig.iStereoSeparation / (200.0f * g_ActiveConfig.iStereoFocalLength);
- constants.stereooffset[0] = offset;
- constants.stereooffset[1] = -offset;
+ constants.stereooffset[0] = (g_ActiveConfig.bStereoSwapEyes) ? -offset : offset;
+ constants.stereooffset[1] = (g_ActiveConfig.bStereoSwapEyes) ? offset : -offset;
}
else
{
diff --git a/Source/Core/VideoCommon/VideoConfig.cpp b/Source/Core/VideoCommon/VideoConfig.cpp
index 18e098652d..4bcb2051f0 100644
--- a/Source/Core/VideoCommon/VideoConfig.cpp
+++ b/Source/Core/VideoCommon/VideoConfig.cpp
@@ -69,6 +69,7 @@ void VideoConfig::Load(const std::string& ini_file)
settings->Get("StereoMode", &iStereoMode, 0);
settings->Get("StereoSeparation", &iStereoSeparation, 65);
settings->Get("StereoFocalLength", &iStereoFocalLength, 100);
+ settings->Get("StereoSwapEyes", &bStereoSwapEyes, false);
settings->Get("EnablePixelLighting", &bEnablePixelLighting, 0);
settings->Get("FastDepthCalc", &bFastDepthCalc, true);
settings->Get("MSAA", &iMultisampleMode, 0);
@@ -143,6 +144,7 @@ void VideoConfig::GameIniLoad()
CHECK_SETTING("Video_Settings", "StereoMode", iStereoMode);
CHECK_SETTING("Video_Settings", "StereoSeparation", iStereoSeparation);
CHECK_SETTING("Video_Settings", "StereoFocalLength", iStereoFocalLength);
+ CHECK_SETTING("Video_Settings", "StereoSwapEyes", bStereoSwapEyes);
CHECK_SETTING("Video_Settings", "EnablePixelLighting", bEnablePixelLighting);
CHECK_SETTING("Video_Settings", "FastDepthCalc", bFastDepthCalc);
CHECK_SETTING("Video_Settings", "MSAA", iMultisampleMode);
@@ -234,6 +236,7 @@ void VideoConfig::Save(const std::string& ini_file)
settings->Set("StereoMode", iStereoMode);
settings->Set("StereoSeparation", iStereoSeparation);
settings->Set("StereoFocalLength", iStereoFocalLength);
+ settings->Set("StereoSwapEyes", bStereoSwapEyes);
settings->Set("EnablePixelLighting", bEnablePixelLighting);
settings->Set("FastDepthCalc", bFastDepthCalc);
settings->Set("ShowEFBCopyRegions", bShowEFBCopyRegions);
diff --git a/Source/Core/VideoCommon/VideoConfig.h b/Source/Core/VideoCommon/VideoConfig.h
index 2eec352021..a03e70bdc6 100644
--- a/Source/Core/VideoCommon/VideoConfig.h
+++ b/Source/Core/VideoCommon/VideoConfig.h
@@ -81,6 +81,7 @@ struct VideoConfig final
int iStereoMode;
int iStereoSeparation;
int iStereoFocalLength;
+ bool bStereoSwapEyes;
// Information
bool bShowFPS;