From: Perttu Ahola Date: Sat, 26 Nov 2011 10:40:25 +0000 (+0200) Subject: Make lighting update occur immediately after ClientActiveObject addition to make... X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=65b2a2cb02098a6806540f5049398e3dbec4675d;p=zefram%2Fminetest%2Fminetest_engine.git Make lighting update occur immediately after ClientActiveObject addition to make objects show up much more responsively --- diff --git a/src/environment.cpp b/src/environment.cpp index a01bf103..c2bc2692 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -2289,8 +2289,18 @@ u16 ClientEnvironment::addActiveObject(ClientActiveObject *object) infostream<<"ClientEnvironment::addActiveObject(): " <<"added (id="<getId()<<")"<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(); }