Add a possibility to totally disable particles.

Particles cause a crash on some radeon devices, so people can at least disable it to make the game working.
Also tfb causes quite big slowdown on slow devices even if there is no particles displayed, so it can give few more fps.
This commit is contained in:
Deve 2017-09-08 00:28:34 +02:00
parent 039a7d0ecc
commit f96863c421
15 changed files with 61 additions and 50 deletions

View File

@ -132,16 +132,6 @@
<spacer height="4" width="10" />
<div layout="horizontal-row" proportion="1" height="fit">
<checkbox id="anim_gfx"/>
<spacer width="10" height="10"/>
<label text="Animated Scenery" I18N="Video settings"/>
</div>
</div>
<spacer height="4" width="10" />
<div layout="horizontal-row" width="100%" proportion="1">
<div layout="horizontal-row" proportion="1" height="fit">
<checkbox id="texture_compression"/>
<spacer width="10" height="10"/>
@ -151,6 +141,14 @@
<spacer height="20" width="10" />
<div layout="horizontal-row" width="100%" proportion="1">
<label text="Animated Scenery" I18N="Video settings" width="40%"/>
<spacer width="10" height="10"/>
<gauge id="anim_gfx" min_value="0" max_value="2" width="50%" />
</div>
<spacer height="4" width="10" />
<div layout="horizontal-row" width="100%" proportion="1">
<label text="Animated Characters" I18N="Video settings" width="40%"/>
<spacer width="10" height="10"/>

View File

@ -73,7 +73,8 @@ ThreeDAnimation::~ThreeDAnimation()
*/
void ThreeDAnimation::update(float dt)
{
//if ( UserConfigParams::m_graphical_effects || m_important_animation )
//if (UserConfigParams::m_graphical_effects > 1 ||
// (UserConfigParams::m_graphical_effects > 0 && m_important_animation))
{
Vec3 xyz = m_object->getPosition();
Vec3 scale = m_object->getScale();

View File

@ -727,9 +727,9 @@ namespace UserConfigParams
#define FBO_DEFAULT true
#endif
PARAM_PREFIX BoolUserConfigParam m_graphical_effects
PARAM_DEFAULT( BoolUserConfigParam(true, "anim_gfx",
&m_graphics_quality, "Scenery animations") );
PARAM_PREFIX IntUserConfigParam m_graphical_effects
PARAM_DEFAULT( IntUserConfigParam(2, "anim_gfx",
&m_graphics_quality, "Scenery animations: 0 disabled, 1 only important, 2 enabled") );
// This saves the actual user preference.
PARAM_PREFIX IntUserConfigParam m_xmas_mode

View File

@ -20,6 +20,7 @@
#include "audio/sfx_base.hpp"
#include "audio/sfx_manager.hpp"
#include "config/user_config.hpp"
#include "graphics/irr_driver.hpp"
#include "graphics/material.hpp"
#include "graphics/material_manager.hpp"
@ -44,7 +45,12 @@ Explosion::Explosion(const Vec3& coord, const char* explosion_sound, const char
#ifndef SERVER_ONLY
ParticleKindManager* pkm = ParticleKindManager::get();
ParticleKind* particles = pkm->getParticles(particle_file);
m_emitter = new ParticleEmitter(particles, coord, NULL);
m_emitter = NULL;
if (UserConfigParams::m_graphical_effects > 0)
{
m_emitter = new ParticleEmitter(particles, coord, NULL);
}
#endif
} // Explosion
@ -76,7 +82,8 @@ bool Explosion::updateAndDelete(float dt)
m_remaining_time -= dt;
#ifndef SERVER_ONLY
if (m_remaining_time < 0.0f && m_remaining_time >= -explosion_time)
if (m_remaining_time < 0.0f && m_remaining_time >= -explosion_time &&
m_emitter != NULL)
{
scene::ISceneNode* node = m_emitter->getNode();
@ -106,7 +113,7 @@ bool Explosion::updateAndDelete(float dt)
#ifndef SERVER_ONLY
// if framerate is very low, emit for at least a few frames, in case
// burst time is lower than the time of 1 frame
if (m_emission_frames > 2)
if (m_emission_frames > 2 && m_emitter != NULL)
{
// Stop the emitter and wait a little while for all particles to have time to fade out
m_emitter->getNode()->getEmitter()->setMinParticlesPerSecond(0);

View File

@ -153,7 +153,7 @@ void Attachment::set(AttachmentType type, float time,
break;
} // switch(type)
if (!UserConfigParams::m_graphical_effects)
if (UserConfigParams::m_graphical_effects < 2)
{
m_node->setAnimationSpeed(0);
m_node->setCurrentFrame(0);
@ -190,7 +190,7 @@ void Attachment::set(AttachmentType type, float time,
m_time_left = m_time_left * speed_mult;
if (UserConfigParams::m_graphical_effects)
if (UserConfigParams::m_graphical_effects > 1)
{
// .blend was created @25 (<10 real, slow computer), make it faster
m_node->setAnimationSpeed(50);

View File

@ -1773,7 +1773,7 @@ void Kart::handleMaterialGFX(float dt)
// something with the wheels, and the material has not the
// below surface property set.
if (material && isOnGround() && !material->isBelowSurface() &&
!getKartAnimation() && UserConfigParams::m_graphical_effects)
!getKartAnimation() && UserConfigParams::m_graphical_effects > 1)
{
// Get the appropriate particle data depending on
@ -1825,7 +1825,7 @@ void Kart::handleMaterialGFX(float dt)
} // for i in all cameras for this kart
} // camera != final camera
if (!UserConfigParams::m_graphical_effects)
if (UserConfigParams::m_graphical_effects < 2)
return;
// Use the middle of the contact points of the two rear wheels
@ -2108,7 +2108,7 @@ void Kart::crashed(const Material *m, const Vec3 &normal)
{
#ifndef SERVER_ONLY
std::string particles = m->getCrashResetParticles();
if (particles.size() > 0)
if (particles.size() > 0 && UserConfigParams::m_graphical_effects > 0)
{
ParticleKind* kind =
ParticleKindManager::get()->getParticles(particles);

View File

@ -45,13 +45,6 @@ KartGFX::KartGFX(const AbstractKart *kart, RaceManager::KartType type, bool is_d
m_kart = kart;
m_wheel_toggle = 0;
m_skid_level = 0;
//if(!UserConfigParams::m_graphical_effects)
//{
// for(unsigned int i=0; i<KGFX_COUNT; i++)
// m_all_emitters.push_back(NULL);
// return;
//}
const KartModel *km = m_kart->getKartModel();
const float length = km->getLength();
@ -173,9 +166,10 @@ void KartGFX::addEffect(KartGFXType type, const std::string &file_name,
const Vec3 &position, bool important)
{
#ifndef SERVER_ONLY
if ((!UserConfigParams::m_graphical_effects || !CVS->isGLSL()) &&
if (((UserConfigParams::m_graphical_effects < 2 || !CVS->isGLSL()) &&
(!important || m_kart->getType() == RaceManager::KT_AI ||
m_kart->getType() == RaceManager::KT_SPARE_TIRE))
m_kart->getType() == RaceManager::KT_SPARE_TIRE)) ||
UserConfigParams::m_graphical_effects < 1)
{
m_all_emitters.push_back(NULL);
return;

View File

@ -805,9 +805,9 @@ int handleCmdLinePreliminary()
UserConfigParams::m_gi = false;
// animated scenery
if (CommandLine::has("--enable-gfx"))
UserConfigParams::m_graphical_effects = true;
UserConfigParams::m_graphical_effects = 2;
else if (CommandLine::has("--disable-gfx"))
UserConfigParams::m_graphical_effects = false;
UserConfigParams::m_graphical_effects = 0;
if (CommandLine::has("--enable-motion-blur"))
UserConfigParams::m_motionblur = true;
else if (CommandLine::has("--disable-motion-blur"))

View File

@ -1007,7 +1007,7 @@ void World::update(float dt)
}
PROFILER_PUSH_CPU_MARKER("World::update (weather)", 0x80, 0x7F, 0x00);
if (UserConfigParams::m_graphical_effects && Weather::getInstance())
if (UserConfigParams::m_graphical_effects > 1 && Weather::getInstance())
{
Weather::getInstance()->update(dt);
}

View File

@ -58,9 +58,15 @@ CustomVideoSettingsDialog::~CustomVideoSettingsDialog()
void CustomVideoSettingsDialog::beforeAddingWidgets()
{
#ifndef SERVER_ONLY
getWidget<CheckBoxWidget>("anim_gfx")->setState(UserConfigParams::m_graphical_effects);
getWidget<CheckBoxWidget>("weather_gfx")->setState(UserConfigParams::m_weather_effects);
getWidget<CheckBoxWidget>("dof")->setState(UserConfigParams::m_dof);
SpinnerWidget* anim_gfx = getWidget<SpinnerWidget>("anim_gfx");
assert(anim_gfx != NULL);
anim_gfx->addLabel(_("Disabled"));
anim_gfx->addLabel(_("Important only"));
anim_gfx->addLabel(_("Enabled"));
anim_gfx->setValue(UserConfigParams::m_graphical_effects);
SpinnerWidget* kart_anim = getWidget<SpinnerWidget>("steering_animations");
kart_anim->addLabel(_("Disabled")); // 0
@ -179,7 +185,7 @@ GUIEngine::EventPropagation CustomVideoSettingsDialog::processEvent(const std::s
getWidget<CheckBoxWidget>("texture_compression")->getState();
UserConfigParams::m_graphical_effects =
getWidget<CheckBoxWidget>("anim_gfx")->getState();
getWidget<SpinnerWidget>("anim_gfx")->getValue();
UserConfigParams::m_weather_effects =
getWidget<CheckBoxWidget>("weather_gfx")->getState();

View File

@ -54,7 +54,7 @@ void OptionsScreenVideo::initPresets()
({
false /* light */, 0 /* shadow */, false /* bloom */, false /* motionblur */,
false /* lightshaft */, false /* glow */, false /* mlaa */, false /* ssao */, false /* weather */,
false /* animatedScenery */, 0 /* animatedCharacters */, 0 /* image_quality */,
1 /* animatedScenery */, 0 /* animatedCharacters */, 0 /* image_quality */,
false /* depth of field */, false /* global illumination */, true /* degraded IBL */
});
@ -62,7 +62,7 @@ void OptionsScreenVideo::initPresets()
({
false /* light */, 0 /* shadow */, false /* bloom */, false /* motionblur */,
false /* lightshaft */, false /* glow */, false /* mlaa */, false /* ssao */, false /* weather */,
true /* animatedScenery */, 1 /* animatedCharacters */, 1 /* image_quality */,
2 /* animatedScenery */, 1 /* animatedCharacters */, 1 /* image_quality */,
false /* depth of field */, false /* global illumination */, true /* degraded IBL */
});
@ -70,7 +70,7 @@ void OptionsScreenVideo::initPresets()
({
true /* light */, 0 /* shadow */, false /* bloom */, false /* motionblur */,
false /* lightshaft */, false /* glow */, false /* mlaa */, false /* ssao */, true /* weather */,
true /* animatedScenery */, 1 /* animatedCharacters */, 2 /* image_quality */,
2 /* animatedScenery */, 1 /* animatedCharacters */, 2 /* image_quality */,
false /* depth of field */, false /* global illumination */, true /* degraded IBL */
});
@ -78,7 +78,7 @@ void OptionsScreenVideo::initPresets()
({
true /* light */, 0 /* shadow */, false /* bloom */, true /* motionblur */,
true /* lightshaft */, true /* glow */, true /* mlaa */, false /* ssao */, true /* weather */,
true /* animatedScenery */, 1 /* animatedCharacters */, 2 /* image_quality */,
2 /* animatedScenery */, 1 /* animatedCharacters */, 2 /* image_quality */,
false /* depth of field */, false /* global illumination */, false /* degraded IBL */
});
@ -86,7 +86,7 @@ void OptionsScreenVideo::initPresets()
({
true /* light */, 512 /* shadow */, true /* bloom */, true /* motionblur */,
true /* lightshaft */, true /* glow */, true /* mlaa */, true /* ssao */, true /* weather */,
true /* animatedScenery */,
2 /* animatedScenery */,
#ifndef SERVER_ONLY
(SharedGPUObjects::getMaxMat4Size() > 512 || !CVS->supportsHardwareSkinning() ? 2 : 1),
#else
@ -100,7 +100,7 @@ void OptionsScreenVideo::initPresets()
({
true /* light */, 1024 /* shadow */, true /* bloom */, true /* motionblur */,
true /* lightshaft */, true /* glow */, true /* mlaa */, true /* ssao */, true /* weather */,
true /* animatedScenery */,
2 /* animatedScenery */,
#ifndef SERVER_ONLY
(SharedGPUObjects::getMaxMat4Size() > 512 || !CVS->supportsHardwareSkinning() ? 2 : 1),
#else
@ -458,6 +458,8 @@ void OptionsScreenVideo::updateTooltip()
const core::stringw me = _LTR("Me Only");
//I18N: if no kart animations are enabled
const core::stringw none = _LTR("None");
//I18N: if only important animated scenery is enabled
const core::stringw important_only = _LTR("Important only");
//I18N: in the graphical options tooltip;
// indicates the rendered image quality is very low
@ -477,7 +479,10 @@ void OptionsScreenVideo::updateTooltip()
// UserConfigParams::m_pixel_shaders ? enabled : disabled);
//I18N: in graphical options
tooltip = _("Animated Scenery: %s",
UserConfigParams::m_graphical_effects ? enabled : disabled);
UserConfigParams::m_graphical_effects == 2 ? enabled :
UserConfigParams::m_graphical_effects == 1 ? important_only :
disabled);
//I18N: in graphical options
tooltip = tooltip + L"\n" + _("Weather Effects: %s",
UserConfigParams::m_weather_effects ? enabled : disabled);

View File

@ -36,7 +36,7 @@ struct GFXPreset
bool mlaa;
bool ssao;
bool weather;
bool animatedScenery;
int animatedScenery;
int animatedCharacters;
int image_quality;
/** Depth of field */

View File

@ -76,7 +76,7 @@ LODNode* ModelDefinitionLoader::instanciateAsLOD(const XMLNode* node, scene::ISc
for (unsigned int m=0; m<group.size(); m++)
{
if (group[m].m_skeletal_animation &&
(UserConfigParams::m_graphical_effects ||
(UserConfigParams::m_graphical_effects > 1 ||
World::getWorld()->getIdent() == IDENT_CUTSCENE))
{
scene::IAnimatedMesh* a_mesh = irr_driver->getAnimatedMesh(group[m].m_model_file);

View File

@ -1522,7 +1522,7 @@ void Track::createWater(const XMLNode &node)
*/
scene::ISceneNode* scene_node = NULL;
/*
if (UserConfigParams::m_graphical_effects)
if (UserConfigParams::m_graphical_effects > 1)
{
scene::IMesh *welded;
scene_node = irr_driver->addWaterNode(mesh, &welded,
@ -2003,7 +2003,7 @@ void Track::loadObjects(const XMLNode* root, const std::string& path, ModelDefin
}
else if (name == "particle-emitter")
{
if (UserConfigParams::m_graphical_effects)
if (UserConfigParams::m_graphical_effects > 1)
{
m_track_object_manager->add(*node, parent, model_def_loader, parent_library);
}

View File

@ -401,7 +401,7 @@ TrackObjectPresentationMesh::TrackObjectPresentationMesh(
m_is_in_skybox = true;
}
bool animated = skeletal_animation && (UserConfigParams::m_graphical_effects ||
bool animated = skeletal_animation && (UserConfigParams::m_graphical_effects > 1 ||
World::getWorld()->getIdent() == IDENT_CUTSCENE);
bool displacing = false;
xml_node.get("displacing", &displacing);
@ -467,7 +467,7 @@ TrackObjectPresentationMesh::TrackObjectPresentationMesh(
m_node = NULL;
m_is_in_skybox = false;
m_render_info = NULL;
bool animated = (UserConfigParams::m_graphical_effects ||
bool animated = (UserConfigParams::m_graphical_effects > 1 ||
World::getWorld()->getIdent() == IDENT_CUTSCENE);
m_model_file = model_file;
@ -512,7 +512,7 @@ void TrackObjectPresentationMesh::init(const XMLNode* xml_node,
if(xml_node)
xml_node->get("skeletal-animation", &skeletal_animation);
bool animated = skeletal_animation && (UserConfigParams::m_graphical_effects ||
bool animated = skeletal_animation && (UserConfigParams::m_graphical_effects > 1 ||
World::getWorld()->getIdent() == IDENT_CUTSCENE);
bool displacing = false;
std::string interaction;