Merge pull request #1766 from Armada651/enable-stereo
Enable stereoscopy settings.
This commit is contained in:
commit
15f074dd21
|
@ -33,4 +33,4 @@ $99 of some treasures
|
|||
$End Boss Has No HP
|
||||
|
||||
[Video_Stereoscopy]
|
||||
StereoMonoEFBDepth = True
|
||||
StereoEFBMonoDepth = True
|
||||
|
|
|
@ -81,8 +81,8 @@ static const struct
|
|||
{ "FreelookZoomOut", 83 /* 'S' */, 4 /* wxMOD_SHIFT */ },
|
||||
{ "FreelookReset", 82 /* 'R' */, 4 /* wxMOD_SHIFT */ },
|
||||
|
||||
{ "IncreaseSeparation", 0, 0 /* wxMOD_NONE */ },
|
||||
{ "DecreaseSeparation", 0, 0 /* wxMOD_NONE */ },
|
||||
{ "IncreaseDepth", 0, 0 /* wxMOD_NONE */ },
|
||||
{ "DecreaseDepth", 0, 0 /* wxMOD_NONE */ },
|
||||
{ "IncreaseConvergence", 0, 0 /* wxMOD_NONE */ },
|
||||
{ "DecreaseConvergence", 0, 0 /* wxMOD_NONE */ },
|
||||
|
||||
|
|
|
@ -54,8 +54,8 @@ enum Hotkey
|
|||
HK_FREELOOK_ZOOM_OUT,
|
||||
HK_FREELOOK_RESET,
|
||||
|
||||
HK_INCREASE_SEPARATION,
|
||||
HK_DECREASE_SEPARATION,
|
||||
HK_INCREASE_DEPTH,
|
||||
HK_DECREASE_DEPTH,
|
||||
HK_INCREASE_CONVERGENCE,
|
||||
HK_DECREASE_CONVERGENCE,
|
||||
|
||||
|
|
|
@ -1123,15 +1123,15 @@ void CFrame::OnKeyDown(wxKeyEvent& event)
|
|||
{
|
||||
State::Load(g_saveSlot);
|
||||
}
|
||||
else if (IsHotkey(event, HK_INCREASE_SEPARATION))
|
||||
else if (IsHotkey(event, HK_INCREASE_DEPTH))
|
||||
{
|
||||
if (++g_Config.iStereoSeparation > 100)
|
||||
g_Config.iStereoSeparation = 100;
|
||||
if (++g_Config.iStereoDepth > 100)
|
||||
g_Config.iStereoDepth = 100;
|
||||
}
|
||||
else if (IsHotkey(event, HK_DECREASE_SEPARATION))
|
||||
else if (IsHotkey(event, HK_DECREASE_DEPTH))
|
||||
{
|
||||
if (--g_Config.iStereoSeparation < 0)
|
||||
g_Config.iStereoSeparation = 0;
|
||||
if (--g_Config.iStereoDepth < 0)
|
||||
g_Config.iStereoDepth = 0;
|
||||
}
|
||||
else if (IsHotkey(event, HK_INCREASE_CONVERGENCE))
|
||||
{
|
||||
|
|
|
@ -238,10 +238,10 @@ void HotkeyConfigDialog::CreateHotkeyGUIControls()
|
|||
_("Freelook Zoom Out"),
|
||||
_("Freelook Reset"),
|
||||
|
||||
_("Increase Stereocopy Separation"),
|
||||
_("Decrease Stereocopy Separation"),
|
||||
_("Increase Stereocopy Convergence"),
|
||||
_("Decrease Stereocopy Convergence"),
|
||||
_("Increase Depth"),
|
||||
_("Decrease Depth"),
|
||||
_("Increase Convergence"),
|
||||
_("Decrease Convergence"),
|
||||
|
||||
_("Load State Slot 1"),
|
||||
_("Load State Slot 2"),
|
||||
|
|
|
@ -150,8 +150,8 @@ static wxString ppshader_desc = wxTRANSLATE("Apply a post-processing effect afte
|
|||
static wxString cache_efb_copies_desc = wxTRANSLATE("Slightly speeds up EFB to RAM copies by sacrificing emulation accuracy.\nSometimes also increases visual quality.\nIf you're experiencing any issues, try raising texture cache accuracy or disable this option.\n\nIf unsure, leave this unchecked.");
|
||||
static wxString shader_errors_desc = wxTRANSLATE("Usually if shader compilation fails, an error message is displayed.\nHowever, one may skip the popups to allow interruption free gameplay by checking this option.\n\nIf unsure, leave this unchecked.");
|
||||
static wxString stereo_3d_desc = wxTRANSLATE("Select the stereoscopic 3D mode, stereoscopy allows you to get a better feeling of depth if you have the necessary hardware.\nSide-by-Side and Top-and-Bottom are used by most 3D TVs.\nAnaglyph is used for Red-Cyan colored glasses.\nHeavily decreases emulation speed and sometimes causes issues.\n\nIf unsure, select Off.");
|
||||
static wxString stereo_separation_desc = wxTRANSLATE("Control the separation distance, this is the distance between the virtual cameras.\nA higher value creates a stronger feeling of depth while a lower value is more comfortable.");
|
||||
static wxString stereo_convergence_desc = wxTRANSLATE("Control the convergence distance, this controls the apparant distance of virtual objects.\nA higher value creates stronger out-of-screen effects while a lower value is more comfortable.");
|
||||
static wxString stereo_depth_desc = wxTRANSLATE("Control the distance between the virtual cameras.\nA higher value creates a stronger feeling of depth while a lower value is more comfortable.");
|
||||
static wxString stereo_convergence_desc = wxTRANSLATE("Control the distance of the convergence plane, this is the distance at which objects will appear to be in front of the screen.\nA higher value creates stronger out-of-screen effects while a lower value is more comfortable.");
|
||||
static wxString stereo_swap_desc = wxTRANSLATE("Swap the left and right eye, mostly useful if you want to view side-by-side cross-eyed.\n\nIf unsure, leave this unchecked.");
|
||||
|
||||
|
||||
|
@ -411,7 +411,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
|
|||
choice_ppshader->AppendString(StrToWxStr(shader));
|
||||
}
|
||||
|
||||
if (vconfig.sPostProcessingShader.empty())
|
||||
if (vconfig.sPostProcessingShader.empty() || vconfig.iStereoMode == STEREO_ANAGLYPH)
|
||||
choice_ppshader->Select(0);
|
||||
else
|
||||
choice_ppshader->SetStringSelection(StrToWxStr(vconfig.sPostProcessingShader));
|
||||
|
@ -449,23 +449,26 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
|
|||
|
||||
// - stereoscopy
|
||||
|
||||
if (vconfig.backend_info.bSupportsGeometryShaders && vconfig.iStereoMode > 0)
|
||||
if (vconfig.backend_info.bSupportsGeometryShaders)
|
||||
{
|
||||
wxFlexGridSizer* const szr_stereo = new wxFlexGridSizer(2, 5, 5);
|
||||
|
||||
const wxString stereo_choices[] = { "Off", "Side-by-Side", "Top-and-Bottom", "Anaglyph", "Nvidia 3D Vision" };
|
||||
szr_stereo->Add(new wxStaticText(page_enh, wxID_ANY, _("Stereoscopic 3D Mode:")), 1, wxALIGN_CENTER_VERTICAL, 0);
|
||||
szr_stereo->Add(CreateChoice(page_enh, vconfig.iStereoMode, wxGetTranslation(stereo_3d_desc), vconfig.backend_info.bSupports3DVision ? 5 : 4, stereo_choices));
|
||||
|
||||
wxSlider* const sep_slider = new wxSlider(page_enh, wxID_ANY, vconfig.iStereoSeparation, 0, 100, wxDefaultPosition, wxDefaultSize);
|
||||
sep_slider->Bind(wxEVT_SLIDER, &VideoConfigDiag::Event_StereoSep, this);
|
||||
RegisterControl(sep_slider, wxGetTranslation(stereo_separation_desc));
|
||||
const wxString stereo_choices[] = { "Off", "Side-by-Side", "Top-and-Bottom", "Anaglyph", "Nvidia 3D Vision" };
|
||||
wxChoice* stereo_choice = CreateChoice(page_enh, vconfig.iStereoMode, wxGetTranslation(stereo_3d_desc), vconfig.backend_info.bSupports3DVision ? ArraySize(stereo_choices) : ArraySize(stereo_choices) - 1, stereo_choices);
|
||||
stereo_choice->Bind(wxEVT_CHOICE, &VideoConfigDiag::Event_StereoMode, this);
|
||||
szr_stereo->Add(stereo_choice);
|
||||
|
||||
szr_stereo->Add(new wxStaticText(page_enh, wxID_ANY, _("Separation:")), 1, wxALIGN_CENTER_VERTICAL, 0);
|
||||
wxSlider* const sep_slider = new wxSlider(page_enh, wxID_ANY, vconfig.iStereoDepth, 0, 100, wxDefaultPosition, wxDefaultSize);
|
||||
sep_slider->Bind(wxEVT_SLIDER, &VideoConfigDiag::Event_StereoDepth, this);
|
||||
RegisterControl(sep_slider, wxGetTranslation(stereo_depth_desc));
|
||||
|
||||
szr_stereo->Add(new wxStaticText(page_enh, wxID_ANY, _("Depth:")), 1, wxALIGN_CENTER_VERTICAL, 0);
|
||||
szr_stereo->Add(sep_slider, 0, wxEXPAND | wxRIGHT);
|
||||
|
||||
wxSlider* const conv_slider = new wxSlider(page_enh, wxID_ANY, vconfig.iStereoConvergence, 0, 500, wxDefaultPosition, wxDefaultSize);
|
||||
conv_slider->Bind(wxEVT_SLIDER, &VideoConfigDiag::Event_StereoFoc, this);
|
||||
conv_slider->Bind(wxEVT_SLIDER, &VideoConfigDiag::Event_StereoConvergence, this);
|
||||
RegisterControl(conv_slider, wxGetTranslation(stereo_convergence_desc));
|
||||
|
||||
szr_stereo->Add(new wxStaticText(page_enh, wxID_ANY, _("Convergence:")), 1, wxALIGN_CENTER_VERTICAL, 0);
|
||||
|
|
|
@ -152,7 +152,7 @@ protected:
|
|||
// Should we enable the configuration button?
|
||||
PostProcessingShaderConfiguration postprocessing_shader;
|
||||
postprocessing_shader.LoadShader(vconfig.sPostProcessingShader);
|
||||
button_config_pp->Enable(postprocessing_shader.HasOptions());
|
||||
button_config_pp->Enable(postprocessing_shader.HasOptions() && vconfig.iStereoMode != STEREO_ANAGLYPH);
|
||||
|
||||
ev.Skip();
|
||||
}
|
||||
|
@ -165,20 +165,36 @@ protected:
|
|||
ev.Skip();
|
||||
}
|
||||
|
||||
void Event_StereoSep(wxCommandEvent &ev)
|
||||
void Event_StereoDepth(wxCommandEvent &ev)
|
||||
{
|
||||
vconfig.iStereoSeparation = ev.GetInt();
|
||||
vconfig.iStereoDepth = ev.GetInt();
|
||||
|
||||
ev.Skip();
|
||||
}
|
||||
|
||||
void Event_StereoFoc(wxCommandEvent &ev)
|
||||
void Event_StereoConvergence(wxCommandEvent &ev)
|
||||
{
|
||||
vconfig.iStereoConvergence = ev.GetInt();
|
||||
|
||||
ev.Skip();
|
||||
}
|
||||
|
||||
void Event_StereoMode(wxCommandEvent &ev)
|
||||
{
|
||||
if (ev.GetInt() == STEREO_ANAGLYPH && vconfig.backend_info.PPShaders.size())
|
||||
{
|
||||
// Anaglyph overrides post-processing shaders
|
||||
choice_ppshader->Select(0);
|
||||
choice_ppshader->Enable(false);
|
||||
}
|
||||
else if (vconfig.backend_info.PPShaders.size())
|
||||
{
|
||||
choice_ppshader->Enable(true);
|
||||
}
|
||||
|
||||
ev.Skip();
|
||||
}
|
||||
|
||||
void Event_ClickClose(wxCommandEvent&);
|
||||
void Event_Close(wxCloseEvent&);
|
||||
|
||||
|
@ -198,12 +214,6 @@ protected:
|
|||
virtual_xfb->Enable(vconfig.bUseXFB);
|
||||
real_xfb->Enable(vconfig.bUseXFB);
|
||||
|
||||
// PP Shaders
|
||||
if (choice_ppshader)
|
||||
choice_ppshader->Enable(vconfig.iStereoMode != STEREO_ANAGLYPH);
|
||||
if (button_config_pp)
|
||||
button_config_pp->Enable(vconfig.iStereoMode != STEREO_ANAGLYPH);
|
||||
|
||||
// Things which shouldn't be changed during emulation
|
||||
if (Core::IsRunning())
|
||||
{
|
||||
|
|
|
@ -421,7 +421,7 @@ void TextureCache::CompileShaders()
|
|||
"}\n" : nullptr;
|
||||
|
||||
const char* prefix = (GProgram == nullptr) ? "f" : "v";
|
||||
const char* depth_layer = (g_ActiveConfig.bStereoMonoEFBDepth) ? "0.0" : "f_uv0.z";
|
||||
const char* depth_layer = (g_ActiveConfig.bStereoEFBMonoDepth) ? "0.0" : "f_uv0.z";
|
||||
|
||||
ProgramShaderCache::CompileShader(s_ColorMatrixProgram, StringFromFormat(VProgram, prefix, prefix).c_str(), pColorMatrixProg, GProgram);
|
||||
ProgramShaderCache::CompileShader(s_DepthMatrixProgram, StringFromFormat(VProgram, prefix, prefix).c_str(), StringFromFormat(pDepthMatrixProg, depth_layer).c_str(), GProgram);
|
||||
|
|
|
@ -53,10 +53,10 @@ void GeometryShaderManager::SetConstants()
|
|||
|
||||
if (xfmem.projection.type == GX_PERSPECTIVE)
|
||||
{
|
||||
float offset = (g_ActiveConfig.iStereoSeparation / 1000.0f) * (g_ActiveConfig.iStereoSeparationPercent / 100.0f);
|
||||
constants.stereoparams[0] = (g_ActiveConfig.bStereoSwapEyes) ? offset : -offset;
|
||||
constants.stereoparams[1] = (g_ActiveConfig.bStereoSwapEyes) ? -offset : offset;
|
||||
constants.stereoparams[2] = (g_ActiveConfig.iStereoConvergence / 10.0f) * (g_ActiveConfig.iStereoConvergencePercent / 100.0f);
|
||||
float offset = (g_ActiveConfig.iStereoDepth / 1000.0f) * (g_ActiveConfig.iStereoDepthPercentage / 100.0f);
|
||||
constants.stereoparams[0] = g_ActiveConfig.bStereoSwapEyes ? offset : -offset;
|
||||
constants.stereoparams[1] = g_ActiveConfig.bStereoSwapEyes ? -offset : offset;
|
||||
constants.stereoparams[2] = g_ActiveConfig.iStereoConvergence * (g_ActiveConfig.iStereoConvergencePercent / 100.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -117,7 +117,7 @@ void TextureCache::OnConfigChanged(VideoConfig& config)
|
|||
}
|
||||
|
||||
if ((config.iStereoMode > 0) != backup_config.s_stereo_3d ||
|
||||
config.bStereoMonoEFBDepth != backup_config.s_mono_efb_depth)
|
||||
config.bStereoEFBMonoDepth != backup_config.s_efb_mono_depth)
|
||||
{
|
||||
g_texture_cache->DeleteShaders();
|
||||
g_texture_cache->CompileShaders();
|
||||
|
@ -134,7 +134,7 @@ void TextureCache::OnConfigChanged(VideoConfig& config)
|
|||
backup_config.s_hires_textures = config.bHiresTextures;
|
||||
backup_config.s_copy_cache_enable = config.bEFBCopyCacheEnable;
|
||||
backup_config.s_stereo_3d = config.iStereoMode > 0;
|
||||
backup_config.s_mono_efb_depth = config.bStereoMonoEFBDepth;
|
||||
backup_config.s_efb_mono_depth = config.bStereoEFBMonoDepth;
|
||||
}
|
||||
|
||||
void TextureCache::Cleanup()
|
||||
|
|
|
@ -146,7 +146,7 @@ private:
|
|||
bool s_hires_textures;
|
||||
bool s_copy_cache_enable;
|
||||
bool s_stereo_3d;
|
||||
bool s_mono_efb_depth;
|
||||
bool s_efb_mono_depth;
|
||||
} backup_config;
|
||||
};
|
||||
|
||||
|
|
|
@ -40,9 +40,9 @@ VideoConfig::VideoConfig()
|
|||
backend_info.bSupportsExclusiveFullscreen = false;
|
||||
|
||||
// Game-specific stereoscopy settings
|
||||
bStereoMonoEFBDepth = false;
|
||||
iStereoSeparationPercent = 100;
|
||||
iStereoConvergencePercent = 100;
|
||||
bStereoEFBMonoDepth = false;
|
||||
iStereoDepthPercentage = 100;
|
||||
iStereoConvergencePercentage = 100;
|
||||
}
|
||||
|
||||
void VideoConfig::Load(const std::string& ini_file)
|
||||
|
@ -88,7 +88,7 @@ void VideoConfig::Load(const std::string& ini_file)
|
|||
enhancements->Get("MaxAnisotropy", &iMaxAnisotropy, 0); // NOTE - this is x in (1 << x)
|
||||
enhancements->Get("PostProcessingShader", &sPostProcessingShader, "");
|
||||
enhancements->Get("StereoMode", &iStereoMode, 0);
|
||||
enhancements->Get("StereoSeparation", &iStereoSeparation, 20);
|
||||
enhancements->Get("StereoDepth", &iStereoDepth, 20);
|
||||
enhancements->Get("StereoConvergence", &iStereoConvergence, 20);
|
||||
enhancements->Get("StereoSwapEyes", &bStereoSwapEyes, false);
|
||||
|
||||
|
@ -185,13 +185,13 @@ void VideoConfig::GameIniLoad()
|
|||
CHECK_SETTING("Video_Enhancements", "MaxAnisotropy", iMaxAnisotropy); // NOTE - this is x in (1 << x)
|
||||
CHECK_SETTING("Video_Enhancements", "PostProcessingShader", sPostProcessingShader);
|
||||
CHECK_SETTING("Video_Enhancements", "StereoMode", iStereoMode);
|
||||
CHECK_SETTING("Video_Enhancements", "StereoSeparation", iStereoSeparation);
|
||||
CHECK_SETTING("Video_Enhancements", "StereoDepth", iStereoDepth);
|
||||
CHECK_SETTING("Video_Enhancements", "StereoConvergence", iStereoConvergence);
|
||||
CHECK_SETTING("Video_Enhancements", "StereoSwapEyes", bStereoSwapEyes);
|
||||
|
||||
CHECK_SETTING("Video_Stereoscopy", "StereoMonoEFBDepth", bStereoMonoEFBDepth);
|
||||
CHECK_SETTING("Video_Stereoscopy", "StereoSeparationPercent", iStereoSeparationPercent);
|
||||
CHECK_SETTING("Video_Stereoscopy", "StereoConvergencePercent", iStereoConvergencePercent);
|
||||
CHECK_SETTING("Video_Stereoscopy", "StereoEFBMonoDepth", bStereoEFBMonoDepth);
|
||||
CHECK_SETTING("Video_Stereoscopy", "StereoDepthPercentage", iStereoDepthPercentage);
|
||||
CHECK_SETTING("Video_Stereoscopy", "StereoConvergencePercentage", iStereoConvergencePercentage);
|
||||
|
||||
CHECK_SETTING("Video_Hacks", "EFBAccessEnable", bEFBAccessEnable);
|
||||
CHECK_SETTING("Video_Hacks", "EFBCopyEnable", bEFBCopyEnable);
|
||||
|
@ -276,7 +276,7 @@ void VideoConfig::Save(const std::string& ini_file)
|
|||
enhancements->Set("MaxAnisotropy", iMaxAnisotropy);
|
||||
enhancements->Set("PostProcessingShader", sPostProcessingShader);
|
||||
enhancements->Set("StereoMode", iStereoMode);
|
||||
enhancements->Set("StereoSeparation", iStereoSeparation);
|
||||
enhancements->Set("StereoDepth", iStereoDepth);
|
||||
enhancements->Set("StereoConvergence", iStereoConvergence);
|
||||
enhancements->Set("StereoSwapEyes", bStereoSwapEyes);
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ struct VideoConfig final
|
|||
int iMaxAnisotropy;
|
||||
std::string sPostProcessingShader;
|
||||
int iStereoMode;
|
||||
int iStereoSeparation;
|
||||
int iStereoDepth;
|
||||
int iStereoConvergence;
|
||||
bool bStereoSwapEyes;
|
||||
|
||||
|
@ -126,9 +126,11 @@ struct VideoConfig final
|
|||
int iSaveTargetId; // TODO: Should be dropped
|
||||
|
||||
// Stereoscopy
|
||||
bool bStereoMonoEFBDepth;
|
||||
bool bStereoEFBMonoDepth;
|
||||
int iStereoSeparationPercent;
|
||||
int iStereoConvergencePercent;
|
||||
int iStereoDepthPercentage;
|
||||
int iStereoConvergencePercentage;
|
||||
|
||||
// D3D only config, mostly to be merged into the above
|
||||
int iAdapter;
|
||||
|
|
Loading…
Reference in New Issue