Adds config and hotkey options for toggling unit silhouettes, based on patches by Ello and mk12. Fixes #1186.

This was SVN commit r11779.
This commit is contained in:
historic_bruno 2012-05-07 01:09:53 +00:00
parent 2fbca07f6d
commit 79c6a2cecc
7 changed files with 26 additions and 4 deletions

View File

@ -35,6 +35,7 @@ shadows = true
shadowpcf = true
vsync = false
particles = true
silhouettes = true
nos3tc = false
noautomipmap = true
@ -116,6 +117,7 @@ hotkey.bigscreenshot = "Shift+F2" ; Take large BMP screenshot
hotkey.togglefullscreen = "Alt+Return" ; Toggle fullscreen/windowed mode
hotkey.screenshot.watermark = "K" ; Toggle product/company watermark for official screenshots
hotkey.wireframe = "Alt+W" ; Toggle wireframe mode
hotkey.silhouettes = "Alt+S" ; Toggle unit silhouettes
; > CAMERA SETTINGS
hotkey.camera.reset = "H" ; Reset camera rotation to default.
@ -222,8 +224,6 @@ profiler2.gpu.arb.enable = true ; Allow GL_ARB_timer_query timing mo
profiler2.gpu.ext.enable = true ; Allow GL_EXT_timer_query timing mode when available
profiler2.gpu.intel.enable = true ; Allow GL_INTEL_performance_queries timing mode when available
hotkey.attackmove = Super
; > QUICKSAVE
hotkey.quicksave = "Shift+F5"
hotkey.quickload = "Shift+F8"

View File

@ -56,6 +56,11 @@
<action on="Press">openMenu();</action>
</object>
<!-- Unit silhouettes -->
<object hotkey="silhouettes">
<action on="Press">renderer.silhouettes = !renderer.silhouettes;</action>
</object>
<!-- Pause -->
<object hotkey="pause">
<action on="Press">togglePause();</action>

View File

@ -39,6 +39,7 @@ bool g_Shadows = false;
bool g_ShadowPCF = false;
bool g_FancyWater = false;
bool g_Particles = false;
bool g_Silhouettes = false;
float g_Gamma = 1.0f;
@ -79,6 +80,7 @@ static void LoadGlobals()
CFG_GET_USER_VAL("fancywater", Bool, g_FancyWater);
CFG_GET_USER_VAL("renderpath", String, g_RenderPath);
CFG_GET_USER_VAL("particles", Bool, g_Particles);
CFG_GET_USER_VAL("particles", Bool, g_Silhouettes);
float gain = -1.0f;
CFG_GET_USER_VAL("sound.mastergain", Float, gain);

View File

@ -52,6 +52,8 @@ extern bool g_FancyWater;
extern bool g_ShadowPCF;
// flag to switch on particles rendering
extern bool g_Particles;
// flag to switch on unit silhouettes
extern bool g_Silhouettes;
extern float g_Gamma;
// name of configured render path (depending on OpenGL extensions, this may not be

View File

@ -583,6 +583,7 @@ static void InitRenderer()
g_Renderer.SetRenderPath(CRenderer::GetRenderPathByName(g_RenderPath));
g_Renderer.SetOptionBool(CRenderer::OPT_SHADOWPCF, g_ShadowPCF);
g_Renderer.SetOptionBool(CRenderer::OPT_PARTICLES, g_Particles);
g_Renderer.SetOptionBool(CRenderer::OPT_SILHOUETTES, g_Silhouettes);
// create terrain related stuff
new CTerrainTextureManager;

View File

@ -426,6 +426,7 @@ CRenderer::CRenderer()
m_Options.m_ARBProgramShadow = true;
m_Options.m_ShadowPCF = false;
m_Options.m_Particles = false;
m_Options.m_Silhouettes = false;
m_Options.m_PreferGLSL = false;
m_Options.m_ForceAlphaTest = false;
m_Options.m_GPUSkinning = false;
@ -459,6 +460,7 @@ CRenderer::CRenderer()
AddLocalProperty(L"waterShininess", &m->waterManager.m_Shininess, false);
AddLocalProperty(L"waterSpecularStrength", &m->waterManager.m_SpecularStrength, false);
AddLocalProperty(L"waterWaviness", &m->waterManager.m_Waviness, false);
AddLocalProperty(L"silhouettes", &m_Options.m_Silhouettes, false);
RegisterFileReloadFunc(ReloadChangedFileCB, this);
}
@ -665,6 +667,9 @@ void CRenderer::SetOptionBool(enum Option opt,bool value)
case OPT_PARTICLES:
m_Options.m_Particles = value;
break;
case OPT_SILHOUETTES:
m_Options.m_Silhouettes = value;
break;
default:
debug_warn(L"CRenderer::SetOptionBool: unknown option");
break;
@ -686,6 +691,8 @@ bool CRenderer::GetOptionBool(enum Option opt) const
return m_Options.m_ShadowPCF;
case OPT_PARTICLES:
return m_Options.m_Particles;
case OPT_SILHOUETTES:
return m_Options.m_Silhouettes;
default:
debug_warn(L"CRenderer::GetOptionBool: unknown option");
break;
@ -1460,7 +1467,10 @@ void CRenderer::RenderSubmissions()
ogl_WarnIfError();
}
RenderSilhouettes(context);
if (m_Options.m_Silhouettes)
{
RenderSilhouettes(context);
}
#if !CONFIG2_GLES
// Clean up texture blend mode so particles and other things render OK

View File

@ -79,7 +79,8 @@ public:
OPT_SHADOWS,
OPT_FANCYWATER,
OPT_SHADOWPCF,
OPT_PARTICLES
OPT_PARTICLES,
OPT_SILHOUETTES
};
enum RenderPath {
@ -127,6 +128,7 @@ public:
bool m_PreferGLSL;
bool m_ForceAlphaTest;
bool m_GPUSkinning;
bool m_Silhouettes;
} m_Options;
struct Caps {