Fix ambient light on track not updated

This commit is contained in:
Benau 2016-12-02 19:17:55 +08:00
parent acf0ac909f
commit 4fbce474c5
2 changed files with 7 additions and 6 deletions

View File

@ -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<video::ITexture*> &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());
}

View File

@ -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)
{