From 4fbce474c58d1fedd67c677a9d4d18b93dfa7725 Mon Sep 17 00:00:00 2001 From: Benau Date: Fri, 2 Dec 2016 19:17:55 +0800 Subject: [PATCH] Fix ambient light on track not updated --- src/graphics/shader_based_renderer.cpp | 8 ++++---- src/tracks/track.cpp | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/graphics/shader_based_renderer.cpp b/src/graphics/shader_based_renderer.cpp index 3b755a9f1..9f5cd7107 100644 --- a/src/graphics/shader_based_renderer.cpp +++ b/src/graphics/shader_based_renderer.cpp @@ -361,8 +361,8 @@ void ShaderBasedRenderer::renderScene(scene::ICameraSceneNode * const camnode, m_rtts->getReflectiveShadowMapFrameBuffer()); } - m_rtts->getFBO(FBO_COMBINED_DIFFUSE_SPECULAR).bind(); - glClear(GL_COLOR_BUFFER_BIT); + m_rtts->getFBO(FBO_COMBINED_DIFFUSE_SPECULAR).bind(); + glClear(GL_COLOR_BUFFER_BIT); m_rtts->getFBO(FBO_DIFFUSE).bind(); if (CVS->isGlobalIlluminationEnabled() && hasShadow) @@ -718,7 +718,7 @@ void ShaderBasedRenderer::addSkyBox(const std::vector &texture if(spherical_harmonics_textures.size() == 6) { m_spherical_harmonics->setTextures(spherical_harmonics_textures); - } + } } // ---------------------------------------------------------------------------- @@ -750,7 +750,7 @@ GLuint ShaderBasedRenderer::getDepthStencilTexture() const void ShaderBasedRenderer::setAmbientLight(const video::SColorf &light, bool force_SH_computation) { - if(!m_spherical_harmonics->has6Textures() || force_SH_computation) + if (force_SH_computation) m_spherical_harmonics->setAmbientLight(light.toSColor()); } diff --git a/src/tracks/track.cpp b/src/tracks/track.cpp index 1d2809934..46fcd696c 100644 --- a/src/tracks/track.cpp +++ b/src/tracks/track.cpp @@ -1819,8 +1819,9 @@ void Track::loadTrackModel(bool reverse_track, unsigned int mode_id) // ---- Set ambient color m_ambient_color = m_default_ambient_color; - irr_driver->setAmbientLight(m_ambient_color, false); - + irr_driver->setAmbientLight(m_ambient_color, + m_spherical_harmonics_textures.size() != 6/*force_SH_computation*/); + // ---- Create sun (non-ambient directional light) if (m_sun_position.getLengthSQ() < 0.03f) {