Make anti-aliasing level configurable

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@11148 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2012-04-25 15:44:17 +00:00
parent b3f6177306
commit b400320745
6 changed files with 59 additions and 26 deletions

View File

@ -23,26 +23,25 @@
<spacer height="5" width="10" />
<div layout="horizontal-row" width="100%" height="fit">
<label text="Animated Characters" I18N="Video settings"/>
<label text="Animated Characters" I18N="Video settings" width="40%"/>
<spacer width="10" height="10"/>
<gauge id="steering_animations" min_value="0" max_value="2" proportion="1" />
<gauge id="steering_animations" min_value="0" max_value="2" width="50%" />
</div>
<spacer height="5" width="10" />
<div layout="horizontal-row" width="100%" height="fit">
<label text="Texture filtering" I18N="Video settings"/>
<label text="Texture filtering" I18N="Video settings" width="40%"/>
<spacer width="10" height="10"/>
<gauge id="filtering" min_value="0" max_value="5" width="50%" />
</div>
<spacer height="5" width="10" />
<!-- TODO: allow selection anti-aliasing quality -->
<div layout="horizontal-row" width="100%" height="fit">
<checkbox id="antialiasing"/>
<label text="Anti-aliasing (requires restart)" I18N="Video settings" width="40%" />
<spacer width="10" height="10"/>
<label text="Anti-aliasing (requires restart)" I18N="Video settings"/>
<gauge id="antialiasing" min_value="0" max_value="3" width="50%"/>
</div>
<spacer height="5" width="10" />

View File

@ -24,7 +24,7 @@
<spacer width="20" height="20"/>
<div layout="vertical-row" proportion="1" height="fit" id="inner_box">
<gauge id="gfx_level" min_value="1" max_value="7" width="300" align="center" />
<gauge id="gfx_level" min_value="1" max_value="8" width="300" align="center" />
<spacer height="5" width="10"/>
<button id="custom" text="Custom settings..." I18N="In the video settings" align="center"/>
</div>

View File

@ -494,10 +494,10 @@ namespace UserConfigParams
&m_graphics_quality,
"Whether trilinear filtering is allowed to be "
"used (true or false)") );
PARAM_PREFIX BoolUserConfigParam m_fullscreen_antialiasing
PARAM_DEFAULT( BoolUserConfigParam(false,
"fullscreen_antialiasing", &m_graphics_quality,
"Whether fullscreen antialiasing is enabled") );
PARAM_PREFIX IntUserConfigParam m_antialiasing
PARAM_DEFAULT( IntUserConfigParam(0,
"antialiasing", &m_graphics_quality,
"Whether antialiasing is enabled (0 = disabled, 1 = 2x, 2 = 4x, 3 = 8x") );
PARAM_PREFIX BoolUserConfigParam m_vsync
PARAM_DEFAULT( BoolUserConfigParam(false, "vsync",
&m_graphics_quality,

View File

@ -252,8 +252,23 @@ void IrrDriver::initDevice()
params.WindowSize =
core::dimension2du(UserConfigParams::m_width,
UserConfigParams::m_height);
if (UserConfigParams::m_fullscreen_antialiasing)
switch ((int)UserConfigParams::m_antialiasing)
{
case 0:
break;
case 1:
params.AntiAlias = 2;
break;
case 2:
params.AntiAlias = 4;
break;
case 3:
params.AntiAlias = 8;
break;
default:
fprintf(stderr, "[IrrDriver] WARNING: Invalid value for anti-alias setting : %i\n",
(int)UserConfigParams::m_antialiasing);
}
m_device = createDeviceEx(params);

View File

@ -76,7 +76,13 @@ void CustomVideoSettingsialog::beforeAddingWidgets()
filtering->setValue( value );
getWidget<CheckBoxWidget>("antialiasing")->setState( UserConfigParams::m_fullscreen_antialiasing );
SpinnerWidget* antialias = getWidget<SpinnerWidget>("antialiasing");
antialias->addLabel( _("Disabled") ); // 0
antialias->addLabel( L"x2" ); // 1
antialias->addLabel( L"x4" ); // 2
antialias->addLabel( L"x8" ); // 3
antialias->setValue( UserConfigParams::m_antialiasing );
getWidget<CheckBoxWidget>("postprocessing")->setState( UserConfigParams::m_postprocess_enabled );
getWidget<CheckBoxWidget>("pixelshaders")->setState( UserConfigParams::m_pixel_shaders );
}
@ -91,8 +97,8 @@ GUIEngine::EventPropagation CustomVideoSettingsialog::processEvent(const std::st
getWidget<CheckBoxWidget>("anim_gfx")->getState();
UserConfigParams::m_weather_effects =
getWidget<CheckBoxWidget>("weather_gfx")->getState();
UserConfigParams::m_fullscreen_antialiasing =
getWidget<CheckBoxWidget>("antialiasing")->getState();
UserConfigParams::m_antialiasing =
getWidget<SpinnerWidget>("antialiasing")->getValue();
UserConfigParams::m_postprocess_enabled =
getWidget<CheckBoxWidget>("postprocessing")->getState();
UserConfigParams::m_show_steering_animations =

View File

@ -45,15 +45,15 @@ using namespace GUIEngine;
DEFINE_SCREEN_SINGLETON( OptionsScreenVideo );
// Look-up table for GFX levels
const bool GFX [] = {false, true, true, true, true, true, true};
const int GFX_ANIM_KARTS[] = {0, 0, 1, 2, 2, 2, 2};
const bool GFX_WEATHER [] = {false, false, false, false, true, true, true};
const bool GFX_ANTIALIAS [] = {false, false, false, false, false, true, true};
const bool GFX [] = {false, true, true, true, true, true, true, true};
const int GFX_ANIM_KARTS[] = {0, 0, 1, 2, 2, 2, 2, 2};
const bool GFX_WEATHER [] = {false, false, false, false, true, true, true, true};
const int GFX_ANTIALIAS [] = {0, 0, 0, 0, 0, 2, 2, 3};
const bool GFX_POSTPROCESSING[] =
{false, false, false, false, false, false, true};
{false, false, false, false, false, false, true, true};
const bool GFX_PIXEL_SHADERS[] =
{false, false, false, false, true, true, true};
const int GFX_LEVEL_AMOUNT = 7;
{false, false, false, false, true, true, true, true};
const int GFX_LEVEL_AMOUNT = 8;
// ----------------------------------------------------------------------------
@ -316,7 +316,7 @@ void OptionsScreenVideo::updateGfxSlider()
if (UserConfigParams::m_show_steering_animations == GFX_ANIM_KARTS[l]&&
UserConfigParams::m_graphical_effects == GFX[l] &&
UserConfigParams::m_weather_effects == GFX_WEATHER[l] &&
UserConfigParams::m_fullscreen_antialiasing == GFX_ANTIALIAS[l] &&
UserConfigParams::m_antialiasing == GFX_ANTIALIAS[l] &&
UserConfigParams::m_postprocess_enabled == GFX_POSTPROCESSING[l] &&
UserConfigParams::m_pixel_shaders == GFX_PIXEL_SHADERS[l])
{
@ -357,6 +357,19 @@ void OptionsScreenVideo::updateTooltip()
//I18N: if no kart animations are enabled
core::stringw none = _LTR("None");
core::stringw antialias_label;
switch ((int)UserConfigParams::m_antialiasing)
{
case 0:
antialias_label = disabled; break;
case 1:
antialias_label = L"x2"; break;
case 2:
antialias_label = L"x4"; break;
case 3:
antialias_label = L"x8"; break;
}
//I18N: in graphical options
tooltip = _("Animated Scenery : %s",
UserConfigParams::m_graphical_effects ? enabled : disabled);
@ -369,8 +382,8 @@ void OptionsScreenVideo::updateTooltip()
? all
: (UserConfigParams::m_show_steering_animations == 1 ? me : none));
//I18N: in graphical options
tooltip = tooltip + L"\n" + _("Anti-aliasing (requires restart) : %s",
UserConfigParams::m_fullscreen_antialiasing ? enabled : disabled);
tooltip = tooltip + L"\n" + _("Anti-aliasing (requires restart) : %s",
antialias_label);
//I18N: in graphical options
tooltip = tooltip + L"\n" + _("Pixel shaders : %s",
UserConfigParams::m_pixel_shaders ? enabled : disabled);
@ -448,7 +461,7 @@ void OptionsScreenVideo::eventCallback(Widget* widget, const std::string& name,
UserConfigParams::m_show_steering_animations = GFX_ANIM_KARTS[level-1];
UserConfigParams::m_graphical_effects = GFX[level-1];
UserConfigParams::m_weather_effects = GFX_WEATHER[level-1];
UserConfigParams::m_fullscreen_antialiasing = GFX_ANTIALIAS[level-1];
UserConfigParams::m_antialiasing = GFX_ANTIALIAS[level-1];
UserConfigParams::m_postprocess_enabled = GFX_POSTPROCESSING[level-1];
UserConfigParams::m_pixel_shaders = GFX_PIXEL_SHADERS[level-1];