|
|
|
|
@@ -20,7 +20,9 @@
|
|
|
|
|
#include "audio/sfx_manager.hpp"
|
|
|
|
|
#include "audio/sfx_base.hpp"
|
|
|
|
|
#include "config/user_config.hpp"
|
|
|
|
|
#include "graphics/central_settings.hpp"
|
|
|
|
|
#include "graphics/irr_driver.hpp"
|
|
|
|
|
#include "graphics/shared_gpu_objects.hpp"
|
|
|
|
|
#include "guiengine/screen.hpp"
|
|
|
|
|
#include "guiengine/widgets/button_widget.hpp"
|
|
|
|
|
#include "guiengine/widgets/check_box_widget.hpp"
|
|
|
|
|
@@ -44,73 +46,63 @@ using namespace GUIEngine;
|
|
|
|
|
|
|
|
|
|
DEFINE_SCREEN_SINGLETON( OptionsScreenVideo );
|
|
|
|
|
|
|
|
|
|
struct GFXPreset
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
void OptionsScreenVideo::initPresets()
|
|
|
|
|
{
|
|
|
|
|
bool lights;
|
|
|
|
|
int shadows;
|
|
|
|
|
bool bloom;
|
|
|
|
|
bool motionblur;
|
|
|
|
|
bool lightshaft;
|
|
|
|
|
bool glow;
|
|
|
|
|
bool mlaa;
|
|
|
|
|
bool ssao;
|
|
|
|
|
bool weather;
|
|
|
|
|
bool animatedScenery;
|
|
|
|
|
int animatedCharacters;
|
|
|
|
|
int anisotropy;
|
|
|
|
|
/** Depth of field */
|
|
|
|
|
bool dof;
|
|
|
|
|
bool global_illumination;
|
|
|
|
|
bool degraded_ibl;
|
|
|
|
|
int hd_textures;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static GFXPreset GFX_PRESETS[] =
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
m_presets.push_back
|
|
|
|
|
({
|
|
|
|
|
false /* light */, 0 /* shadow */, false /* bloom */, false /* motionblur */,
|
|
|
|
|
false /* lightshaft */, false /* glow */, false /* mlaa */, false /* ssao */, false /* weather */,
|
|
|
|
|
false /* animatedScenery */, 0 /* animatedCharacters */, 0 /* anisotropy */,
|
|
|
|
|
false /* depth of field */, false /* global illumination */, true /* degraded IBL */, 0 /* hd_textures */
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
m_presets.push_back
|
|
|
|
|
({
|
|
|
|
|
false /* light */, 0 /* shadow */, false /* bloom */, false /* motionblur */,
|
|
|
|
|
false /* lightshaft */, false /* glow */, false /* mlaa */, false /* ssao */, false /* weather */,
|
|
|
|
|
true /* animatedScenery */, 1 /* animatedCharacters */, 4 /* anisotropy */,
|
|
|
|
|
false /* depth of field */, false /* global illumination */, true /* degraded IBL */, 0 /* hd_textures */
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
m_presets.push_back
|
|
|
|
|
({
|
|
|
|
|
true /* light */, 0 /* shadow */, false /* bloom */, false /* motionblur */,
|
|
|
|
|
false /* lightshaft */, false /* glow */, false /* mlaa */, false /* ssao */, true /* weather */,
|
|
|
|
|
true /* animatedScenery */, 1 /* animatedCharacters */, 4 /* anisotropy */,
|
|
|
|
|
false /* depth of field */, false /* global illumination */, true /* degraded IBL */, 1 /* hd_textures */
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
m_presets.push_back
|
|
|
|
|
({
|
|
|
|
|
true /* light */, 0 /* shadow */, false /* bloom */, true /* motionblur */,
|
|
|
|
|
true /* lightshaft */, true /* glow */, true /* mlaa */, false /* ssao */, true /* weather */,
|
|
|
|
|
true /* animatedScenery */, 1 /* animatedCharacters */, 8 /* anisotropy */,
|
|
|
|
|
false /* depth of field */, false /* global illumination */, false /* degraded IBL */, 1 /* hd_textures */
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
m_presets.push_back
|
|
|
|
|
({
|
|
|
|
|
true /* light */, 512 /* shadow */, true /* bloom */, true /* motionblur */,
|
|
|
|
|
true /* lightshaft */, true /* glow */, true /* mlaa */, true /* ssao */, true /* weather */,
|
|
|
|
|
true /* animatedScenery */, 2 /* animatedCharacters */, 16 /* anisotropy */,
|
|
|
|
|
true /* animatedScenery */,
|
|
|
|
|
(SharedGPUObjects::getMaxMat4Size() > 512 || !CVS->supportsHardwareSkinning() ? 2 : 1)/* animatedCharacters */,
|
|
|
|
|
16 /* anisotropy */,
|
|
|
|
|
true /* depth of field */, false /* global illumination */, false /* degraded IBL */, 1 /* hd_textures */
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
m_presets.push_back
|
|
|
|
|
({
|
|
|
|
|
true /* light */, 1024 /* shadow */, true /* bloom */, true /* motionblur */,
|
|
|
|
|
true /* lightshaft */, true /* glow */, true /* mlaa */, true /* ssao */, true /* weather */,
|
|
|
|
|
true /* animatedScenery */, 2 /* animatedCharacters */, 16 /* anisotropy */,
|
|
|
|
|
true /* animatedScenery */,
|
|
|
|
|
(SharedGPUObjects::getMaxMat4Size() > 512 || !CVS->supportsHardwareSkinning() ? 2 : 1)/* animatedCharacters */,
|
|
|
|
|
16 /* anisotropy */,
|
|
|
|
|
true /* depth of field */, true /* global illumination */, false /* degraded IBL */, 1 /* hd_textures */
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
static const int GFX_LEVEL_AMOUNT = 6;
|
|
|
|
|
} // initPresets
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
struct Resolution
|
|
|
|
|
{
|
|
|
|
|
@@ -144,6 +136,7 @@ struct Resolution
|
|
|
|
|
OptionsScreenVideo::OptionsScreenVideo() : Screen("options_video.stkgui")
|
|
|
|
|
{
|
|
|
|
|
m_inited = false;
|
|
|
|
|
initPresets();
|
|
|
|
|
} // OptionsScreenVideo
|
|
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
@@ -151,12 +144,12 @@ OptionsScreenVideo::OptionsScreenVideo() : Screen("options_video.stkgui")
|
|
|
|
|
void OptionsScreenVideo::loadedFromFile()
|
|
|
|
|
{
|
|
|
|
|
m_inited = false;
|
|
|
|
|
|
|
|
|
|
assert(m_presets.size() == 6);
|
|
|
|
|
|
|
|
|
|
GUIEngine::SpinnerWidget* gfx =
|
|
|
|
|
getWidget<GUIEngine::SpinnerWidget>("gfx_level");
|
|
|
|
|
gfx->m_properties[GUIEngine::PROP_MAX_VALUE] =
|
|
|
|
|
StringUtils::toString(GFX_LEVEL_AMOUNT);
|
|
|
|
|
StringUtils::toString(m_presets.size());
|
|
|
|
|
|
|
|
|
|
} // loadedFromFile
|
|
|
|
|
|
|
|
|
|
@@ -334,25 +327,25 @@ void OptionsScreenVideo::updateGfxSlider()
|
|
|
|
|
assert( gfx != NULL );
|
|
|
|
|
|
|
|
|
|
bool found = false;
|
|
|
|
|
for (int l=0; l<GFX_LEVEL_AMOUNT; l++)
|
|
|
|
|
for (unsigned int l = 0; l < m_presets.size(); l++)
|
|
|
|
|
{
|
|
|
|
|
if (GFX_PRESETS[l].animatedCharacters == UserConfigParams::m_show_steering_animations &&
|
|
|
|
|
GFX_PRESETS[l].animatedScenery == UserConfigParams::m_graphical_effects &&
|
|
|
|
|
GFX_PRESETS[l].anisotropy == UserConfigParams::m_anisotropic &&
|
|
|
|
|
GFX_PRESETS[l].bloom == UserConfigParams::m_bloom &&
|
|
|
|
|
GFX_PRESETS[l].glow == UserConfigParams::m_glow &&
|
|
|
|
|
GFX_PRESETS[l].lights == UserConfigParams::m_dynamic_lights &&
|
|
|
|
|
GFX_PRESETS[l].lightshaft == UserConfigParams::m_light_shaft &&
|
|
|
|
|
GFX_PRESETS[l].mlaa == UserConfigParams::m_mlaa &&
|
|
|
|
|
GFX_PRESETS[l].motionblur == UserConfigParams::m_motionblur &&
|
|
|
|
|
//GFX_PRESETS[l].shaders == UserConfigParams::m_pixel_shaders
|
|
|
|
|
GFX_PRESETS[l].shadows == UserConfigParams::m_shadows_resolution &&
|
|
|
|
|
GFX_PRESETS[l].ssao == UserConfigParams::m_ssao &&
|
|
|
|
|
GFX_PRESETS[l].weather == UserConfigParams::m_weather_effects &&
|
|
|
|
|
GFX_PRESETS[l].dof == UserConfigParams::m_dof &&
|
|
|
|
|
GFX_PRESETS[l].global_illumination == UserConfigParams::m_gi &&
|
|
|
|
|
GFX_PRESETS[l].degraded_ibl == UserConfigParams::m_degraded_IBL &&
|
|
|
|
|
GFX_PRESETS[l].hd_textures == (UserConfigParams::m_high_definition_textures & 0x01))
|
|
|
|
|
if (m_presets[l].animatedCharacters == UserConfigParams::m_show_steering_animations &&
|
|
|
|
|
m_presets[l].animatedScenery == UserConfigParams::m_graphical_effects &&
|
|
|
|
|
m_presets[l].anisotropy == UserConfigParams::m_anisotropic &&
|
|
|
|
|
m_presets[l].bloom == UserConfigParams::m_bloom &&
|
|
|
|
|
m_presets[l].glow == UserConfigParams::m_glow &&
|
|
|
|
|
m_presets[l].lights == UserConfigParams::m_dynamic_lights &&
|
|
|
|
|
m_presets[l].lightshaft == UserConfigParams::m_light_shaft &&
|
|
|
|
|
m_presets[l].mlaa == UserConfigParams::m_mlaa &&
|
|
|
|
|
m_presets[l].motionblur == UserConfigParams::m_motionblur &&
|
|
|
|
|
//m_presets[l].shaders == UserConfigParams::m_pixel_shaders
|
|
|
|
|
m_presets[l].shadows == UserConfigParams::m_shadows_resolution &&
|
|
|
|
|
m_presets[l].ssao == UserConfigParams::m_ssao &&
|
|
|
|
|
m_presets[l].weather == UserConfigParams::m_weather_effects &&
|
|
|
|
|
m_presets[l].dof == UserConfigParams::m_dof &&
|
|
|
|
|
m_presets[l].global_illumination == UserConfigParams::m_gi &&
|
|
|
|
|
m_presets[l].degraded_ibl == UserConfigParams::m_degraded_IBL &&
|
|
|
|
|
m_presets[l].hd_textures == (UserConfigParams::m_high_definition_textures & 0x01))
|
|
|
|
|
{
|
|
|
|
|
gfx->setValue(l + 1);
|
|
|
|
|
found = true;
|
|
|
|
|
@@ -513,23 +506,23 @@ void OptionsScreenVideo::eventCallback(Widget* widget, const std::string& name,
|
|
|
|
|
|
|
|
|
|
const int level = gfx_level->getValue() - 1;
|
|
|
|
|
|
|
|
|
|
UserConfigParams::m_show_steering_animations = GFX_PRESETS[level].animatedCharacters;
|
|
|
|
|
UserConfigParams::m_graphical_effects = GFX_PRESETS[level].animatedScenery;
|
|
|
|
|
UserConfigParams::m_anisotropic = GFX_PRESETS[level].anisotropy;
|
|
|
|
|
UserConfigParams::m_bloom = GFX_PRESETS[level].bloom;
|
|
|
|
|
UserConfigParams::m_glow = GFX_PRESETS[level].glow;
|
|
|
|
|
UserConfigParams::m_dynamic_lights = GFX_PRESETS[level].lights;
|
|
|
|
|
UserConfigParams::m_light_shaft = GFX_PRESETS[level].lightshaft;
|
|
|
|
|
UserConfigParams::m_mlaa = GFX_PRESETS[level].mlaa;
|
|
|
|
|
UserConfigParams::m_motionblur = GFX_PRESETS[level].motionblur;
|
|
|
|
|
//UserConfigParams::m_pixel_shaders = GFX_PRESETS[level].shaders;
|
|
|
|
|
UserConfigParams::m_shadows_resolution = GFX_PRESETS[level].shadows;
|
|
|
|
|
UserConfigParams::m_ssao = GFX_PRESETS[level].ssao;
|
|
|
|
|
UserConfigParams::m_weather_effects = GFX_PRESETS[level].weather;
|
|
|
|
|
UserConfigParams::m_dof = GFX_PRESETS[level].dof;
|
|
|
|
|
UserConfigParams::m_gi = GFX_PRESETS[level].global_illumination;
|
|
|
|
|
UserConfigParams::m_degraded_IBL = GFX_PRESETS[level].degraded_ibl;
|
|
|
|
|
UserConfigParams::m_high_definition_textures = 0x02 | GFX_PRESETS[level].hd_textures;
|
|
|
|
|
UserConfigParams::m_show_steering_animations = m_presets[level].animatedCharacters;
|
|
|
|
|
UserConfigParams::m_graphical_effects = m_presets[level].animatedScenery;
|
|
|
|
|
UserConfigParams::m_anisotropic = m_presets[level].anisotropy;
|
|
|
|
|
UserConfigParams::m_bloom = m_presets[level].bloom;
|
|
|
|
|
UserConfigParams::m_glow = m_presets[level].glow;
|
|
|
|
|
UserConfigParams::m_dynamic_lights = m_presets[level].lights;
|
|
|
|
|
UserConfigParams::m_light_shaft = m_presets[level].lightshaft;
|
|
|
|
|
UserConfigParams::m_mlaa = m_presets[level].mlaa;
|
|
|
|
|
UserConfigParams::m_motionblur = m_presets[level].motionblur;
|
|
|
|
|
//UserConfigParams::m_pixel_shaders = m_presets[level].shaders;
|
|
|
|
|
UserConfigParams::m_shadows_resolution = m_presets[level].shadows;
|
|
|
|
|
UserConfigParams::m_ssao = m_presets[level].ssao;
|
|
|
|
|
UserConfigParams::m_weather_effects = m_presets[level].weather;
|
|
|
|
|
UserConfigParams::m_dof = m_presets[level].dof;
|
|
|
|
|
UserConfigParams::m_gi = m_presets[level].global_illumination;
|
|
|
|
|
UserConfigParams::m_degraded_IBL = m_presets[level].degraded_ibl;
|
|
|
|
|
UserConfigParams::m_high_definition_textures = 0x02 | m_presets[level].hd_textures;
|
|
|
|
|
|
|
|
|
|
updateGfxSlider();
|
|
|
|
|
}
|
|
|
|
|
|