Clouds *g_menuclouds = NULL;
irr::scene::ISceneManager *g_menucloudsmgr = NULL;
+static void cloud_3d_setting_changed(const std::string settingname, void *data)
+{
+ ((Clouds *)data)->readSettings();
+}
+
Clouds::Clouds(
scene::ISceneNode* parent,
scene::ISceneManager* mgr,
//m_material.MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
m_material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
- m_cloud_y = BS * (cloudheight ? cloudheight :
- g_settings->getS16("cloud_height"));
-
- m_cloud_radius_i = g_settings->getU16("cloud_radius");
-
- m_enable_3d = g_settings->getBool("enable_3d_clouds");
+ m_passed_cloud_y = cloudheight;
+ readSettings();
+ g_settings->registerChangedCallback("enable_3d_clouds",
+ &cloud_3d_setting_changed, this);
m_box = core::aabbox3d<f32>(-BS*1000000,m_cloud_y-BS,-BS*1000000,
BS*1000000,m_cloud_y+BS,BS*1000000);
Clouds::~Clouds()
{
+ g_settings->deregisterChangedCallback("enable_3d_clouds",
+ &cloud_3d_setting_changed, this);
}
void Clouds::OnRegisterSceneNode()
//dstream<<"m_brightness="<<m_brightness<<std::endl;
}
+void Clouds::readSettings()
+{
+ m_cloud_y = BS * (m_passed_cloud_y ? m_passed_cloud_y :
+ g_settings->getS16("cloud_height"));
+ m_cloud_radius_i = g_settings->getU16("cloud_radius");
+ m_enable_3d = g_settings->getBool("enable_3d_clouds");
+}
+