From 6b9f4f511519e43a066522df45402f323ab0643b Mon Sep 17 00:00:00 2001 From: TurboK234 Date: Thu, 30 Jul 2015 00:25:47 +0300 Subject: [PATCH] Added hotkeys for toggling different stereoscopy modes --- Source/Core/Core/HotkeyManager.cpp | 5 +++ Source/Core/Core/HotkeyManager.h | 5 +++ Source/Core/DolphinWX/Frame.cpp | 64 ++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+) diff --git a/Source/Core/Core/HotkeyManager.cpp b/Source/Core/Core/HotkeyManager.cpp index f992bef281..097634709c 100644 --- a/Source/Core/Core/HotkeyManager.cpp +++ b/Source/Core/Core/HotkeyManager.cpp @@ -63,6 +63,11 @@ const std::string hotkey_labels[] = _trans("Freelook Zoom Out"), _trans("Freelook Reset"), + _trans("Toggle 3D Side-by-side"), + _trans("Toggle 3D Top-bottom"), + _trans("Toggle 3D Anaglyph"), + _trans("Toggle 3D Vision"), + _trans("Decrease Depth"), _trans("Increase Depth"), _trans("Decrease Convergence"), diff --git a/Source/Core/Core/HotkeyManager.h b/Source/Core/Core/HotkeyManager.h index 75da4450b9..1b352a5320 100644 --- a/Source/Core/Core/HotkeyManager.h +++ b/Source/Core/Core/HotkeyManager.h @@ -62,6 +62,11 @@ enum Hotkey HK_FREELOOK_ZOOM_OUT, HK_FREELOOK_RESET, + HK_TOGGLE_STEREO_SBS, + HK_TOGGLE_STEREO_TAB, + HK_TOGGLE_STEREO_ANAGLYPH, + HK_TOGGLE_STEREO_3DVISION, + HK_DECREASE_DEPTH, HK_INCREASE_DEPTH, HK_DECREASE_CONVERGENCE, diff --git a/Source/Core/DolphinWX/Frame.cpp b/Source/Core/DolphinWX/Frame.cpp index 75a9de022e..183a7b2517 100644 --- a/Source/Core/DolphinWX/Frame.cpp +++ b/Source/Core/DolphinWX/Frame.cpp @@ -1418,6 +1418,70 @@ void CFrame::ParseHotkeys() State::Load(g_saveSlot); } + if (IsHotkey(HK_TOGGLE_STEREO_SBS)) + { + if (g_Config.iStereoMode != STEREO_SBS) + { + // Current implementation of anaglyph stereoscopy uses a + // post-processing shader. Thus the shader needs to be to be + // turned off when selecting other stereoscopy modes. + if (g_Config.sPostProcessingShader == "dubois") + { + g_Config.sPostProcessingShader = ""; + } + g_Config.iStereoMode = STEREO_SBS; + } + else + { + g_Config.iStereoMode = STEREO_OFF; + } + } + if (IsHotkey(HK_TOGGLE_STEREO_TAB)) + { + if (g_Config.iStereoMode != STEREO_TAB) + { + if (g_Config.sPostProcessingShader == "dubois") + { + g_Config.sPostProcessingShader = ""; + } + g_Config.iStereoMode = STEREO_TAB; + } + else + { + g_Config.iStereoMode = STEREO_OFF; + } + } + if (IsHotkey(HK_TOGGLE_STEREO_ANAGLYPH)) + { + if (g_Config.iStereoMode != STEREO_ANAGLYPH) + { + // Setting the anaglyph mode also requires a specific + // post-processing shader to be activated. + g_Config.iStereoMode = STEREO_ANAGLYPH; + g_Config.sPostProcessingShader = "dubois"; + } + else + { + g_Config.iStereoMode = STEREO_OFF; + g_Config.sPostProcessingShader = ""; + } + } + if (IsHotkey(HK_TOGGLE_STEREO_3DVISION)) + { + if (g_Config.iStereoMode != STEREO_3DVISION) + { + if (g_Config.sPostProcessingShader == "dubois") + { + g_Config.sPostProcessingShader = ""; + } + g_Config.iStereoMode = STEREO_3DVISION; + } + else + { + g_Config.iStereoMode = STEREO_OFF; + } + } + auto savePreset = [](const std::string& param, int value) { IniFile localIni = SConfig::GetInstance().LoadLocalGameIni();