diff --git a/src/graphics/irr_driver.cpp b/src/graphics/irr_driver.cpp index 0a621677e..50a55b908 100644 --- a/src/graphics/irr_driver.cpp +++ b/src/graphics/irr_driver.cpp @@ -2121,6 +2121,7 @@ scene::ISceneNode *IrrDriver::addLight(const core::vector3df &pos, float energy, { if (m_glsl) { + if (parent == NULL) parent = m_scene_manager->getRootSceneNode(); LightNode *light = NULL; if (!sun) @@ -2129,7 +2130,6 @@ scene::ISceneNode *IrrDriver::addLight(const core::vector3df &pos, float energy, light = new SunNode(m_scene_manager, parent, r, g, b); light->grab(); - light->setParent(NULL); light->setPosition(pos); light->updateAbsolutePosition(); diff --git a/src/graphics/render.cpp b/src/graphics/render.cpp index e1c74bdb8..8b5cc5e13 100644 --- a/src/graphics/render.cpp +++ b/src/graphics/render.cpp @@ -740,7 +740,7 @@ void IrrDriver::renderLights(const core::aabbox3df& cambox, light_node->setEnergyMultiplier(std::min(1.0f, em + dt)); } - const core::vector3df &pos = light_node->getPosition(); + const core::vector3df &pos = light_node->getAbsolutePosition(); accumulatedLightPos.push_back(pos.X); accumulatedLightPos.push_back(pos.Y); accumulatedLightPos.push_back(pos.Z);