diff --git a/src/graphics/irr_driver.hpp b/src/graphics/irr_driver.hpp index aea712904..b73134e0d 100644 --- a/src/graphics/irr_driver.hpp +++ b/src/graphics/irr_driver.hpp @@ -364,7 +364,6 @@ private: void renderShadows(); void renderGlow(std::vector& glows); void renderSSAO(); - unsigned UpdateLightsInfo(scene::ICameraSceneNode * const camnode, float dt); void renderLights(unsigned pointlightCount); void renderDisplacement(); void doScreenShot(); @@ -698,6 +697,7 @@ public: void onUnloadWorld(); void renderScene(scene::ICameraSceneNode * const camnode, unsigned pointlightcount, std::vector& glows, float dt, bool hasShadows, bool forceRTT); + unsigned UpdateLightsInfo(scene::ICameraSceneNode * const camnode, float dt); void computeCameraMatrix(scene::ICameraSceneNode * const camnode, size_t width, size_t height); // --------------------- RTT -------------------- diff --git a/src/graphics/render.cpp b/src/graphics/render.cpp index a7e2ef4f2..c80ac8f03 100644 --- a/src/graphics/render.cpp +++ b/src/graphics/render.cpp @@ -1023,9 +1023,9 @@ void IrrDriver::renderLights(unsigned pointlightcount) irr_driver->getSceneManager()->setAmbientLight(SColor(0, 0, 0, 0)); // Render sunlight if and only if track supports shadow - if (World::getWorld() && World::getWorld()->getTrack()->hasShadows()) + if (!World::getWorld() || World::getWorld()->getTrack()->hasShadows()) { - if (UserConfigParams::m_shadows) + if (World::getWorld() && UserConfigParams::m_shadows) m_post_processing->renderShadowedSunlight(sun_ortho_matrix, m_rtts->getShadowDepthTex()); else m_post_processing->renderSunlight(); diff --git a/src/guiengine/widgets/model_view_widget.cpp b/src/guiengine/widgets/model_view_widget.cpp index 10a79fe3b..d955c5f70 100644 --- a/src/guiengine/widgets/model_view_widget.cpp +++ b/src/guiengine/widgets/model_view_widget.cpp @@ -179,7 +179,8 @@ void ModelViewWidget::update(float delta) std::vector glows; irr_driver->computeCameraMatrix(m_camera, 512, 512); - irr_driver->renderScene(m_camera, 0, glows, GUIEngine::getLatestDt(), false, true); + unsigned plc = irr_driver->UpdateLightsInfo(m_camera, GUIEngine::getLatestDt()); + irr_driver->renderScene(m_camera, plc, glows, GUIEngine::getLatestDt(), false, true); m_frame_buffer = irr_driver->getPostProcessing()->render(m_camera); glViewport(0, 0, UserConfigParams::m_width, UserConfigParams::m_height);