Merge pull request #2788 from TurboK234/3d_hotkeys

Added hotkeys for toggling different stereoscopy modes
This commit is contained in:
Markus Wick 2015-12-02 15:24:59 +01:00
commit abbc25f662
3 changed files with 74 additions and 0 deletions

View File

@ -64,6 +64,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"),

View File

@ -63,6 +63,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,

View File

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