Disable all karts animation if UBO size not big enough
This commit is contained in:
parent
4327885f07
commit
a420b09363
@ -19,6 +19,7 @@
|
||||
|
||||
#include "graphics/shared_gpu_objects.hpp"
|
||||
#include "graphics/central_settings.hpp"
|
||||
#include "utils/log.hpp"
|
||||
|
||||
#include "matrix4.h"
|
||||
#include <algorithm>
|
||||
@ -184,6 +185,8 @@ void SharedGPUObjects::initSkinningUBO()
|
||||
glGetIntegerv(GL_MAX_UNIFORM_BLOCK_SIZE, &max_size);
|
||||
max_size = std::min(max_size, 65536);
|
||||
m_max_mat4_size = max_size / 16 / sizeof(float);
|
||||
Log::info("SharedGPUObjects", "Hardware skinning supported, max joints"
|
||||
" support: %d", m_max_mat4_size);
|
||||
glBufferData(GL_UNIFORM_BUFFER, max_size, 0, GL_STREAM_DRAW);
|
||||
// Reserve a identity matrix for non moving mesh in animated model used by
|
||||
// vertex shader calculation
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "utils/translation.hpp"
|
||||
#include "graphics/central_settings.hpp"
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "graphics/shared_gpu_objects.hpp"
|
||||
|
||||
#include <IGUIEnvironment.h>
|
||||
|
||||
@ -36,8 +37,12 @@ using namespace irr::gui;
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
CustomVideoSettingsDialog::CustomVideoSettingsDialog(const float w, const float h) :
|
||||
ModalDialog(w, h)
|
||||
ModalDialog(w, h), m_all_kart_animated(true)
|
||||
{
|
||||
#ifndef SERVER_ONLY
|
||||
m_all_kart_animated = SharedGPUObjects::getMaxMat4Size() > 512 ||
|
||||
!CVS->supportsHardwareSkinning();
|
||||
#endif
|
||||
loadFromFile("custom_video_settings.stkgui");
|
||||
updateActivation();
|
||||
}
|
||||
@ -64,8 +69,11 @@ void CustomVideoSettingsDialog::beforeAddingWidgets()
|
||||
//I18N: animations setting (only karts with human players are animated)
|
||||
kart_anim->addLabel(_("Human players only")); // 1
|
||||
//I18N: animations setting (all karts are animated)
|
||||
kart_anim->addLabel(_("Enabled for all")); // 2
|
||||
kart_anim->setValue(UserConfigParams::m_show_steering_animations);
|
||||
if (m_all_kart_animated)
|
||||
kart_anim->addLabel(_("Enabled for all")); // 2
|
||||
kart_anim->setValue(!m_all_kart_animated &&
|
||||
UserConfigParams::m_show_steering_animations == 2 ?
|
||||
1 : UserConfigParams::m_show_steering_animations);
|
||||
|
||||
SpinnerWidget* filtering = getWidget<SpinnerWidget>("filtering");
|
||||
int value = 0;
|
||||
@ -242,6 +250,8 @@ void CustomVideoSettingsDialog::updateActivation()
|
||||
getWidget<CheckBoxWidget>("global_illumination")->setActive(light);
|
||||
getWidget<CheckBoxWidget>("glow")->setActive(light);
|
||||
getWidget<CheckBoxWidget>("bloom")->setActive(light);
|
||||
getWidget<SpinnerWidget>("steering_animations")
|
||||
->setMax(m_all_kart_animated ? 2 : 1);
|
||||
|
||||
if (!CVS->supportsShadows() && !CVS->supportsGlobalIllumination())
|
||||
{
|
||||
|
@ -27,7 +27,8 @@
|
||||
*/
|
||||
class CustomVideoSettingsDialog : public GUIEngine::ModalDialog
|
||||
{
|
||||
|
||||
private:
|
||||
bool m_all_kart_animated;
|
||||
public:
|
||||
/**
|
||||
* Creates a modal dialog with given percentage of screen width and height
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -25,7 +25,26 @@
|
||||
|
||||
namespace GUIEngine { class Widget; }
|
||||
|
||||
struct Input;
|
||||
struct GFXPreset
|
||||
{
|
||||
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;
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Graphics options screen
|
||||
@ -33,11 +52,14 @@ struct Input;
|
||||
*/
|
||||
class OptionsScreenVideo : public GUIEngine::Screen, public GUIEngine::ScreenSingleton<OptionsScreenVideo>
|
||||
{
|
||||
private:
|
||||
OptionsScreenVideo();
|
||||
bool m_inited;
|
||||
std::vector<GFXPreset> m_presets;
|
||||
|
||||
void updateTooltip();
|
||||
|
||||
void initPresets();
|
||||
public:
|
||||
friend class GUIEngine::ScreenSingleton<OptionsScreenVideo>;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user