VertexShaderManager: Add stereoscopy options to swap the left and right eye.

This commit is contained in:
Jules Blok 2014-10-31 16:05:44 +01:00
parent c3ad6e7820
commit 1261bd02ca
4 changed files with 9 additions and 2 deletions

View File

@ -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);

View File

@ -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
{

View File

@ -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);

View File

@ -81,6 +81,7 @@ struct VideoConfig final
int iStereoMode;
int iStereoSeparation;
int iStereoFocalLength;
bool bStereoSwapEyes;
// Information
bool bShowFPS;