diff options
author | SmallJoker <SmallJoker@users.noreply.github.com> | 2020-06-01 19:01:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-01 19:01:47 +0200 |
commit | a08d18acad345363780f5286300d65b39ea9c9f9 (patch) | |
tree | 0929b7f73ea7c781a8c46aeafdd445634b55a443 /src/client/clientenvironment.cpp | |
parent | f849917bbe9c5eff51bee0a3125eabed16efb172 (diff) | |
download | minetest-a08d18acad345363780f5286300d65b39ea9c9f9.tar.xz |
ContentCAO: Update light of all attached entities (#9975)
Diffstat (limited to 'src/client/clientenvironment.cpp')
-rw-r--r-- | src/client/clientenvironment.cpp | 30 |
1 files changed, 3 insertions, 27 deletions
diff --git a/src/client/clientenvironment.cpp b/src/client/clientenvironment.cpp index 6840f2db3..44ea1e4a1 100644 --- a/src/client/clientenvironment.cpp +++ b/src/client/clientenvironment.cpp @@ -320,21 +320,8 @@ void ClientEnvironment::step(float dtime) // Step object cao->step(dtime, this); - if (update_lighting) { - // Update lighting - u8 light = 0; - bool pos_ok; - - // Get node at head - v3s16 p = cao->getLightPosition(); - MapNode n = this->m_map->getNode(p, &pos_ok); - if (pos_ok) - light = n.getLightBlend(day_night_ratio, m_client->ndef()); - else - light = blend_light(day_night_ratio, LIGHT_SUN, 0); - - cao->updateLight(light); - } + if (update_lighting) + cao->updateLight(day_night_ratio); }; m_ao_manager.step(dtime, cb_state); @@ -402,18 +389,7 @@ u16 ClientEnvironment::addActiveObject(ClientActiveObject *object) object->addToScene(m_texturesource); // Update lighting immediately - u8 light = 0; - bool pos_ok; - - // Get node at head - v3s16 p = object->getLightPosition(); - MapNode n = m_map->getNode(p, &pos_ok); - if (pos_ok) - light = n.getLightBlend(getDayNightRatio(), m_client->ndef()); - else - light = blend_light(getDayNightRatio(), LIGHT_SUN, 0); - - object->updateLight(light); + object->updateLight(getDayNightRatio()); return object->getId(); } |