RTT: avoid computing diffuse coefficients every frame
This commit is contained in:
parent
f651321ceb
commit
97100db507
@ -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)
|
FrameBuffer* RTT::render(scene::ICameraSceneNode* camera, float dt)
|
||||||
{
|
{
|
||||||
irr_driver->setRTT(this);
|
irr_driver->setRTT(this);
|
||||||
@ -298,7 +305,7 @@ FrameBuffer* RTT::render(scene::ICameraSceneNode* camera, float dt)
|
|||||||
|
|
||||||
std::vector<IrrDriver::GlowData> glows;
|
std::vector<IrrDriver::GlowData> glows;
|
||||||
// TODO: put this outside of the rendering loop
|
// TODO: put this outside of the rendering loop
|
||||||
irr_driver->generateDiffuseCoefficients();
|
//irr_driver->generateDiffuseCoefficients();
|
||||||
irr_driver->computeMatrixesAndCameras(camera, m_width, m_height);
|
irr_driver->computeMatrixesAndCameras(camera, m_width, m_height);
|
||||||
unsigned plc = irr_driver->updateLightsInfo(camera, dt);
|
unsigned plc = irr_driver->updateLightsInfo(camera, dt);
|
||||||
irr_driver->uploadLightingData();
|
irr_driver->uploadLightingData();
|
||||||
|
@ -52,6 +52,8 @@ public:
|
|||||||
|
|
||||||
FrameBuffer* render(irr::scene::ICameraSceneNode* camera, float dt);
|
FrameBuffer* render(irr::scene::ICameraSceneNode* camera, float dt);
|
||||||
|
|
||||||
|
void prepareRender(scene::ICameraSceneNode* camera);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
unsigned RenderTargetTextures[RTT_COUNT];
|
unsigned RenderTargetTextures[RTT_COUNT];
|
||||||
PtrVector<FrameBuffer> FrameBuffers;
|
PtrVector<FrameBuffer> FrameBuffers;
|
||||||
|
@ -281,6 +281,8 @@ void ModelViewWidget::setupRTTScene(PtrVector<scene::IMesh, REF>& mesh,
|
|||||||
m_camera->setTarget(core::vector3df(0, 10, 0.0f));
|
m_camera->setTarget(core::vector3df(0, 10, 0.0f));
|
||||||
m_camera->setFOV(DEGREE_TO_RAD*50.0f);
|
m_camera->setFOV(DEGREE_TO_RAD*50.0f);
|
||||||
m_camera->updateAbsolutePosition();
|
m_camera->updateAbsolutePosition();
|
||||||
|
|
||||||
|
m_rtt_provider->prepareRender(m_camera);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelViewWidget::setRotateOff()
|
void ModelViewWidget::setRotateOff()
|
||||||
|
Loading…
Reference in New Issue
Block a user