diff options
author | Perttu Ahola <celeron55@gmail.com> | 2011-11-26 12:40:25 +0200 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2011-11-29 19:13:53 +0200 |
commit | 65b2a2cb02098a6806540f5049398e3dbec4675d (patch) | |
tree | 75a4fd5affa87eabf59413e7d745b0c1a23d6709 | |
parent | 70363847aacbf765c60a294940ba50c8bb256cc6 (diff) | |
download | minetest-65b2a2cb02098a6806540f5049398e3dbec4675d.tar.gz minetest-65b2a2cb02098a6806540f5049398e3dbec4675d.tar.bz2 minetest-65b2a2cb02098a6806540f5049398e3dbec4675d.zip |
Make lighting update occur immediately after ClientActiveObject addition to make objects show up much more responsively
-rw-r--r-- | src/environment.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/environment.cpp b/src/environment.cpp index a01bf1037..c2bc2692e 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -2289,8 +2289,18 @@ u16 ClientEnvironment::addActiveObject(ClientActiveObject *object) infostream<<"ClientEnvironment::addActiveObject(): " <<"added (id="<<object->getId()<<")"<<std::endl; m_active_objects.insert(object->getId(), object); - // TODO: Make g_texturesource non-global object->addToScene(m_smgr, m_texturesource); + { // Update lighting immediately + u8 light = 0; + try{ + // Get node at head + v3s16 p = object->getLightPosition(); + MapNode n = m_map->getNode(p); + light = n.getLightBlend(getDayNightRatio(), m_gamedef->ndef()); + } + catch(InvalidPositionException &e) {} + object->updateLight(light); + } return object->getId(); } |