RTT: avoid computing diffuse coefficients every frame

This commit is contained in:
Marianne Gagnon 2015-06-15 19:21:34 -04:00
parent f651321ceb
commit 97100db507
3 changed files with 12 additions and 1 deletions

View File

@ -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<IrrDriver::GlowData> 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();

View File

@ -52,6 +52,8 @@ public:
FrameBuffer* render(irr::scene::ICameraSceneNode* camera, float dt);
void prepareRender(scene::ICameraSceneNode* camera);
private:
unsigned RenderTargetTextures[RTT_COUNT];
PtrVector<FrameBuffer> FrameBuffers;

View File

@ -281,6 +281,8 @@ void ModelViewWidget::setupRTTScene(PtrVector<scene::IMesh, REF>& 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()