diff --git a/src/graphics/rtts.cpp b/src/graphics/rtts.cpp index 5342ac3e4..f83be6b13 100644 --- a/src/graphics/rtts.cpp +++ b/src/graphics/rtts.cpp @@ -290,6 +290,13 @@ RTT::~RTT() } } +void RTT::prepareRender(scene::ICameraSceneNode* camera) +{ + irr_driver->setRTT(this); + irr_driver->getSceneManager()->setActiveCamera(camera); + irr_driver->generateDiffuseCoefficients(); +} + FrameBuffer* RTT::render(scene::ICameraSceneNode* camera, float dt) { irr_driver->setRTT(this); @@ -298,7 +305,7 @@ FrameBuffer* RTT::render(scene::ICameraSceneNode* camera, float dt) std::vector glows; // TODO: put this outside of the rendering loop - irr_driver->generateDiffuseCoefficients(); + //irr_driver->generateDiffuseCoefficients(); irr_driver->computeMatrixesAndCameras(camera, m_width, m_height); unsigned plc = irr_driver->updateLightsInfo(camera, dt); irr_driver->uploadLightingData(); diff --git a/src/graphics/rtts.hpp b/src/graphics/rtts.hpp index f0e428175..a37ba1df7 100644 --- a/src/graphics/rtts.hpp +++ b/src/graphics/rtts.hpp @@ -52,6 +52,8 @@ public: FrameBuffer* render(irr::scene::ICameraSceneNode* camera, float dt); + void prepareRender(scene::ICameraSceneNode* camera); + private: unsigned RenderTargetTextures[RTT_COUNT]; PtrVector FrameBuffers; diff --git a/src/guiengine/widgets/model_view_widget.cpp b/src/guiengine/widgets/model_view_widget.cpp index c369dc580..683b3de4a 100644 --- a/src/guiengine/widgets/model_view_widget.cpp +++ b/src/guiengine/widgets/model_view_widget.cpp @@ -281,6 +281,8 @@ void ModelViewWidget::setupRTTScene(PtrVector& mesh, m_camera->setTarget(core::vector3df(0, 10, 0.0f)); m_camera->setFOV(DEGREE_TO_RAD*50.0f); m_camera->updateAbsolutePosition(); + + m_rtt_provider->prepareRender(m_camera); } void ModelViewWidget::setRotateOff()