Only calculate diffuse coefficient once.

This commit is contained in:
vlj 2014-08-04 01:12:45 +02:00
parent 03c3f1dae7
commit 6c71334cda
3 changed files with 6 additions and 0 deletions

View File

@ -1204,6 +1204,7 @@ scene::ISceneNode *IrrDriver::addSkyBox(const std::vector<video::ITexture*> &tex
SkyboxTextures = texture;
SphericalHarmonicsTextures = sphericalHarmonics;
SkyboxCubeMap = 0;
m_SH_dirty = true;
return m_scene_manager->addSkyBoxSceneNode(texture[0], texture[1],
texture[2], texture[3],
texture[4], texture[5]);
@ -1213,6 +1214,7 @@ void IrrDriver::suppressSkyBox()
{
SkyboxTextures.clear();
SphericalHarmonicsTextures.clear();
m_SH_dirty = true;
if ((SkyboxCubeMap) && (!ProfileWorld::isNoGraphics()))
glDeleteTextures(1, &SkyboxCubeMap);
SkyboxCubeMap = 0;

View File

@ -233,6 +233,7 @@ private:
std::vector<video::ITexture *> SkyboxTextures;
std::vector<video::ITexture *> SphericalHarmonicsTextures;
bool m_SH_dirty;
float blueSHCoeff[9];
float greenSHCoeff[9];

View File

@ -437,6 +437,9 @@ void IrrDriver::generateSkyboxCubemap()
void IrrDriver::generateDiffuseCoefficients()
{
if (!m_SH_dirty)
return;
m_SH_dirty = false;
const unsigned texture_permutation[] = { 2, 3, 0, 1, 5, 4 };
if (SphericalHarmonicsTextures.size() == 6)