Only calculate diffuse coefficient once.
This commit is contained in:
parent
03c3f1dae7
commit
6c71334cda
@ -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;
|
||||
|
@ -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];
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user