Add sun to rtt

This commit is contained in:
Vincent Lejeune 2014-06-05 01:44:15 +02:00
parent 219bfbca93
commit f995c31372
3 changed files with 5 additions and 4 deletions

View File

@ -364,7 +364,6 @@ private:
void renderShadows();
void renderGlow(std::vector<GlowData>& 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<GlowData>& 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 --------------------

View File

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

View File

@ -179,7 +179,8 @@ void ModelViewWidget::update(float delta)
std::vector<IrrDriver::GlowData> 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);