aboutsummaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/game.cpp b/src/game.cpp
index ec025b73f..b496cf3bf 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -809,16 +809,35 @@ class GameGlobalShaderConstantSetter : public IShaderConstantSetter
bool *m_force_fog_off;
f32 *m_fog_range;
Client *m_client;
+ bool m_fogEnabled;
public:
+ void onSettingsChange(const std::string &name)
+ {
+ if (name == "enable_fog")
+ m_fogEnabled = g_settings->getBool("enable_fog");
+ }
+
+ static void SettingsCallback(const std::string name, void *userdata)
+ {
+ reinterpret_cast<GameGlobalShaderConstantSetter*>(userdata)->onSettingsChange(name);
+ }
+
GameGlobalShaderConstantSetter(Sky *sky, bool *force_fog_off,
f32 *fog_range, Client *client) :
m_sky(sky),
m_force_fog_off(force_fog_off),
m_fog_range(fog_range),
m_client(client)
- {}
- ~GameGlobalShaderConstantSetter() {}
+ {
+ g_settings->registerChangedCallback("enable_fog", SettingsCallback, this);
+ m_fogEnabled = g_settings->getBool("enable_fog");
+ }
+
+ ~GameGlobalShaderConstantSetter()
+ {
+ g_settings->deregisterChangedCallback("enable_fog", SettingsCallback, this);
+ }
virtual void onSetConstants(video::IMaterialRendererServices *services,
bool is_highlevel)