Improved coding style and added doxygen comments in ShericalHarmonics class

This commit is contained in:
Elderme
2015-08-06 14:47:38 +02:00
parent 0b479a8bb0
commit 9ea3d4958a
9 changed files with 156 additions and 190 deletions

View File

@@ -1,37 +0,0 @@
// SuperTuxKart - a fun racing game with go-kart
// Copyright (C) 2014-2015 SuperTuxKart-Team
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 3
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "graphics/IBL.hpp"
#include "graphics/central_settings.hpp"
#include "graphics/gl_headers.hpp"
#include "graphics/shaders.hpp"
#include "graphics/shared_gpu_objects.hpp"
#include <cmath>
#include <set>
#include "graphics/sphericalHarmonic.hpp"
// ============================================================================

View File

@@ -1,25 +0,0 @@
// SuperTuxKart - a fun racing game with go-kart
// Copyright (C) 2014-2015 SuperTuxKart-Team
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 3
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef IBL_HPP
#define IBL_HPP
#include "gl_headers.hpp"
#endif

View File

@@ -122,7 +122,7 @@ IrrDriver::IrrDriver()
m_post_processing = NULL;
m_wind = new Wind();
m_skybox = NULL;
m_spherical_harmonic = NULL;
m_spherical_harmonics = NULL;
m_mipviz = m_wireframe = m_normals = m_ssaoviz = false;
m_lightviz = m_shadowviz = m_distortviz = m_rsm = m_rh = m_gi = false;
@@ -1362,7 +1362,7 @@ scene::ISceneNode *IrrDriver::addSkyDome(video::ITexture *texture,
* \param back: Texture for the back plane of the box.
*/
scene::ISceneNode *IrrDriver::addSkyBox(const std::vector<video::ITexture*> &texture,
const std::vector<video::ITexture*> &sphericalHarmonics)
const std::vector<video::ITexture*> &spherical_harmonics_textures)
{
assert(texture.size() == 6);
/*SkyboxTextures = texture;
@@ -1376,13 +1376,13 @@ scene::ISceneNode *IrrDriver::addSkyBox(const std::vector<video::ITexture*> &tex
//m_skybox_ready = true;
m_skybox = new Skybox(texture);
if(sphericalHarmonics.size() == 6)
if(spherical_harmonics_textures.size() == 6)
{
if(m_spherical_harmonic != NULL)
if(m_spherical_harmonics != NULL)
{
delete m_spherical_harmonic;
delete m_spherical_harmonics;
}
m_spherical_harmonic = new SphericalHarmonic(sphericalHarmonics);
m_spherical_harmonics = new SphericalHarmonics(spherical_harmonics_textures);
}
else
{
@@ -1409,8 +1409,8 @@ void IrrDriver::suppressSkyBox()
SkyboxSpecularProbe = 0;*/
delete m_skybox;
m_skybox = NULL;
delete m_spherical_harmonic;
m_spherical_harmonic = NULL;
delete m_spherical_harmonics;
m_spherical_harmonics = NULL;
}
// ----------------------------------------------------------------------------
@@ -1792,8 +1792,8 @@ void IrrDriver::setAmbientLight(const video::SColorf &light)
m_scene_manager->setAmbientLight(light);
//TODO!
if(m_spherical_harmonic == NULL)
m_spherical_harmonic = new SphericalHarmonic(light.toSColor());
if(m_spherical_harmonics == NULL)
m_spherical_harmonics = new SphericalHarmonics(light.toSColor());
//m_skybox_ready = false;
} // setAmbientLight

View File

@@ -38,7 +38,7 @@
#include "ISkinnedMesh.h"
#include "graphics/gl_headers.hpp"
#include "graphics/skybox.hpp"
#include "graphics/sphericalHarmonic.hpp"
#include "graphics/sphericalHarmonics.hpp"
#include "graphics/wind.hpp"
#include "io/file_manager.hpp"
#include "utils/aligned_array.hpp"
@@ -221,7 +221,7 @@ private:
//bool m_skybox_ready;
Skybox *m_skybox;
SphericalHarmonic *m_spherical_harmonic;
SphericalHarmonics *m_spherical_harmonics;
public:
//float blueSHCoeff[9];
@@ -410,7 +410,7 @@ public:
int vert_res, float texture_percent,
float sphere_percent);
scene::ISceneNode *addSkyBox(const std::vector<video::ITexture*> &texture_names,
const std::vector<video::ITexture*> &sphericalHarmonics);
const std::vector<video::ITexture*> &spherical_harmonics_textures);
void suppressSkyBox();
void removeNode(scene::ISceneNode *node);
void removeMeshFromCache(scene::IMesh *mesh);
@@ -537,8 +537,8 @@ public:
/** Returns a pointer to the skybox. */
inline Skybox *getSkybox() {return m_skybox;}
// -----------------------------------------------------------------------
/** Returns a pointer to spherical harmonic. */
inline SphericalHarmonic *getSphericalHarmonic() {return m_spherical_harmonic;}
/** Returns a pointer to spherical harmonics. */
inline SphericalHarmonics *getSphericalHarmonics() {return m_spherical_harmonics;}
// -----------------------------------------------------------------------
const core::vector3df& getSunDirection() const { return m_sun_direction; };
// -----------------------------------------------------------------------

View File

@@ -418,10 +418,10 @@ void IrrDriver::uploadLightingData()
Lighting[6] = m_suncolor.getBlue();
Lighting[7] = 0.54f;
if(m_spherical_harmonic) {
memcpy(&Lighting[8], m_spherical_harmonic->getBlueSHCoeff(), 9 * sizeof(float));
memcpy(&Lighting[17], m_spherical_harmonic->getGreenSHCoeff(), 9 * sizeof(float));
memcpy(&Lighting[26], m_spherical_harmonic->getRedSHCoeff(), 9 * sizeof(float));
if(m_spherical_harmonics) {
memcpy(&Lighting[8], m_spherical_harmonics->getBlueSHCoeff(), 9 * sizeof(float));
memcpy(&Lighting[17], m_spherical_harmonics->getGreenSHCoeff(), 9 * sizeof(float));
memcpy(&Lighting[26], m_spherical_harmonics->getRedSHCoeff(), 9 * sizeof(float));
}
glBindBuffer(GL_UNIFORM_BUFFER, SharedGPUObjects::getLightingDataUBO());

View File

@@ -174,15 +174,15 @@ void ShaderBase::bypassUBO() const
irr_driver->getCurrentScreenSize().Y);
GLint bLmn = glGetUniformLocation(m_program, "blueLmn[0]");
const float* blue_SH_coeff = irr_driver->getSphericalHarmonic()->getBlueSHCoeff();
const float* blue_SH_coeff = irr_driver->getSphericalHarmonics()->getBlueSHCoeff();
glUniform1fv(bLmn, 9, blue_SH_coeff);
GLint gLmn = glGetUniformLocation(m_program, "greenLmn[0]");
const float* green_SH_coeff = irr_driver->getSphericalHarmonic()->getGreenSHCoeff();
const float* green_SH_coeff = irr_driver->getSphericalHarmonics()->getGreenSHCoeff();
glUniform1fv(gLmn, 9, green_SH_coeff);
GLint rLmn = glGetUniformLocation(m_program, "redLmn[0]");
const float* red_SH_coeff = irr_driver->getSphericalHarmonic()->getRedSHCoeff();
const float* red_SH_coeff = irr_driver->getSphericalHarmonics()->getRedSHCoeff();
glUniform1fv(rLmn, 9, red_SH_coeff);
GLint sun_dir = glGetUniformLocation(m_program, "sun_direction");

View File

@@ -18,7 +18,6 @@
#include "graphics/skybox.hpp"
#include "graphics/central_settings.hpp"
#include "graphics/IBL.hpp"
#include "graphics/irr_driver.hpp"
#include "graphics/shaders.hpp"

View File

@@ -17,19 +17,23 @@
#include "graphics/irr_driver.hpp"
#include "graphics/sphericalHarmonic.hpp"
#include "graphics/sphericalHarmonics.hpp"
#include "utils/log.hpp"
#include <algorithm>
#include <cassert>
#include <irrlicht.h>
using namespace irr;
namespace
{
{
/** Convert an unsigned char cubemap texture to a float texture
* \param sh_rgba The 6 faces of the cubemap texture
* \param sh_w Texture width
* \param sh_h Texture height
* \param[out] float_tex_cube The converted float cubemap texture
*/
void convertToFloatTexture(unsigned char *sh_rgba[6], unsigned sh_w, unsigned sh_h, Color *float_tex_cube[6])
{
for (unsigned i = 0; i < 6; i++)
@@ -44,16 +48,29 @@ namespace
}
} //convertToFloatTexture
// ----------------------------------------------------------------------------
// ------------------------------------------------------------------------
/** Print the nine first spherical harmonics coefficients
* \param SH_coeff The nine spherical harmonics coefficients
*/
void displayCoeff(float *SH_coeff)
{
Log::debug("SphericalHarmonic", "L00:%f", SH_coeff[0]);
Log::debug("SphericalHarmonic", "L1-1:%f, L10:%f, L11:%f", SH_coeff[1], SH_coeff[2], SH_coeff[3]);
Log::debug("SphericalHarmonic", "L2-2:%f, L2-1:%f, L20:%f, L21:%f, L22:%f",
SH_coeff[4], SH_coeff[5], SH_coeff[6], SH_coeff[7], SH_coeff[8]);
Log::debug("SphericalHarmonics", "L00:%f", SH_coeff[0]);
Log::debug("SphericalHarmonics", "L1-1:%f, L10:%f, L11:%f",
SH_coeff[1], SH_coeff[2], SH_coeff[3]);
Log::debug("SphericalHarmonics", "L2-2:%f, L2-1:%f, L20:%f, L21:%f, L22:%f",
SH_coeff[4], SH_coeff[5], SH_coeff[6], SH_coeff[7], SH_coeff[8]);
} // displayCoeff
// ----------------------------------------------------------------------------
// ------------------------------------------------------------------------
/** Compute the value of the (i,j) texel of the environment map
* from the spherical harmonics coefficients
* \param i The texel line
* \param j The texel column
* \param width The texture width
* \param height The texture height
* \param Coeff The 9 first SH coefficients for a color channel (blue, green or red)
* \param Yml The sphericals harmonics functions values on each texel of the cubemap
*/
float getTexelValue(unsigned i, unsigned j, size_t width, size_t height,
float *Coeff, float *Y00, float *Y1minus1,
float *Y10, float *Y11, float *Y2minus2,
@@ -72,8 +89,16 @@ namespace
reconstructedVal /= solidangle;
return std::max(255.0f * reconstructedVal, 0.f);
} // getTexelValue
// ------------------------------------------------------------------------
/** Return a normalized vector aiming at a texel on a cubemap
* \param face The face of the cubemap
* \param j The texel line in the face
* \param j The texel column in the face
* \param x The x vector component
* \param y The y vector component
* \param z The z vector component
*/
void getXYZ(GLenum face, float i, float j, float &x, float &y, float &z)
{
switch (face)
@@ -115,18 +140,17 @@ namespace
return;
} // getXYZ
// ----------------------------------------------------------------------------
// ------------------------------------------------------------------------
/** Compute the value of the spherical harmonics basis functions (Yml)
* on each texel of a cubemap face
* \param face Face of the cubemap
* \param edge_size Size of the cubemap face
* \param[out] Yml Table of the sphericals harmonics functions values
*/
* on each texel of a cubemap face
* \param face Face of the cubemap
* \param edge_size Size of the cubemap face
* \param[out] Yml The sphericals harmonics functions values on each texel of the cubemap
*/
void getYml(GLenum face, size_t edge_size,
float *Y00,
float *Y1minus1, float *Y10, float *Y11,
float *Y2minus2, float *Y2minus1, float *Y20, float *Y21, float *Y22)
float *Y00,
float *Y1minus1, float *Y10, float *Y11,
float *Y2minus2, float *Y2minus1, float *Y20, float *Y21, float *Y22)
{
#pragma omp parallel for
for (int i = 0; i < int(edge_size); i++)
@@ -167,21 +191,23 @@ namespace
} //namespace
// ----------------------------------------------------------------------------
void SphericalHarmonic::projectSH(Color *cubemap_face[6], size_t edge_size, float *Y00[],
float *Y1minus1[], float *Y10[], float *Y11[],
float *Y2minus2[], float *Y2minus1[], float * Y20[],
float *Y21[], float *Y22[], float *blue_sh_coeff,
float *green_sh_coeff, float *red_sh_coeff)
/** Compute m_red_SH_coeff, m_green_SH_coeff and m_blue_SH_coeff from Yml values
* \param cubemap_face The 6 cubemap faces (float textures)
* \param edge_size Size of the cubemap face
* \param Yml The sphericals harmonics functions values on each texel of the cubemap
*/
void SphericalHarmonics::projectSH(Color *cubemap_face[6], size_t edge_size,
float *Y00[],
float *Y1minus1[], float *Y10[], float *Y11[],
float *Y2minus2[], float *Y2minus1[], float * Y20[],
float *Y21[], float *Y22[])
{
for (unsigned i = 0; i < 9; i++)
{
blue_sh_coeff[i] = 0;
green_sh_coeff[i] = 0;
red_sh_coeff[i] = 0;
m_blue_SH_coeff[i] = 0;
m_green_SH_coeff[i] = 0;
m_red_SH_coeff[i] = 0;
}
float wh = float(edge_size * edge_size);
@@ -246,46 +272,44 @@ void SphericalHarmonic::projectSH(Color *cubemap_face[6], size_t edge_size, floa
}
}
blue_sh_coeff[0] = b0;
blue_sh_coeff[1] = b1;
blue_sh_coeff[2] = b2;
blue_sh_coeff[3] = b3;
blue_sh_coeff[4] = b4;
blue_sh_coeff[5] = b5;
blue_sh_coeff[6] = b6;
blue_sh_coeff[7] = b7;
blue_sh_coeff[8] = b8;
m_blue_SH_coeff[0] = b0;
m_blue_SH_coeff[1] = b1;
m_blue_SH_coeff[2] = b2;
m_blue_SH_coeff[3] = b3;
m_blue_SH_coeff[4] = b4;
m_blue_SH_coeff[5] = b5;
m_blue_SH_coeff[6] = b6;
m_blue_SH_coeff[7] = b7;
m_blue_SH_coeff[8] = b8;
red_sh_coeff[0] = r0;
red_sh_coeff[1] = r1;
red_sh_coeff[2] = r2;
red_sh_coeff[3] = r3;
red_sh_coeff[4] = r4;
red_sh_coeff[5] = r5;
red_sh_coeff[6] = r6;
red_sh_coeff[7] = r7;
red_sh_coeff[8] = r8;
m_red_SH_coeff[0] = r0;
m_red_SH_coeff[1] = r1;
m_red_SH_coeff[2] = r2;
m_red_SH_coeff[3] = r3;
m_red_SH_coeff[4] = r4;
m_red_SH_coeff[5] = r5;
m_red_SH_coeff[6] = r6;
m_red_SH_coeff[7] = r7;
m_red_SH_coeff[8] = r8;
green_sh_coeff[0] = g0;
green_sh_coeff[1] = g1;
green_sh_coeff[2] = g2;
green_sh_coeff[3] = g3;
green_sh_coeff[4] = g4;
green_sh_coeff[5] = g5;
green_sh_coeff[6] = g6;
green_sh_coeff[7] = g7;
green_sh_coeff[8] = g8;
m_green_SH_coeff[0] = g0;
m_green_SH_coeff[1] = g1;
m_green_SH_coeff[2] = g2;
m_green_SH_coeff[3] = g3;
m_green_SH_coeff[4] = g4;
m_green_SH_coeff[5] = g5;
m_green_SH_coeff[6] = g6;
m_green_SH_coeff[7] = g7;
m_green_SH_coeff[8] = g8;
} // projectSH
// ----------------------------------------------------------------------------
/** Generate the 9 first SH coefficients for each color channel
* using the cubemap provided by CubemapFace.
* \param textures sequence of 6 square textures.
* \param row/columns count of textures.
* \param cubemap_face The 6 cubemap faces (float textures)
* \param edge_size Size of the cubemap face
*/
void SphericalHarmonic::generateSphericalHarmonics(Color *cubemap_face[6], size_t edge_size,
float *blue_sh_coeff, float *green_sh_coeff,
float *red_sh_coeff)
void SphericalHarmonics::generateSphericalHarmonics(Color *cubemap_face[6], size_t edge_size)
{
float *Y00[6];
float *Y1minus1[6];
@@ -315,8 +339,7 @@ void SphericalHarmonic::generateSphericalHarmonics(Color *cubemap_face[6], size_
}
projectSH(cubemap_face, edge_size, Y00, Y1minus1, Y10, Y11, Y2minus2,
Y2minus1, Y20, Y21, Y22, blue_sh_coeff, green_sh_coeff,
red_sh_coeff);
Y2minus1, Y20, Y21, Y22);
for (unsigned face = 0; face < 6; face++)
{
@@ -333,7 +356,7 @@ void SphericalHarmonic::generateSphericalHarmonics(Color *cubemap_face[6], size_
} // generateSphericalHarmonics
// ----------------------------------------------------------------------------
SphericalHarmonic::SphericalHarmonic(const std::vector<video::ITexture *> &spherical_harmonics_textures)
SphericalHarmonics::SphericalHarmonics(const std::vector<video::ITexture *> &spherical_harmonics_textures)
{
assert(spherical_harmonics_textures.size() == 6);
@@ -370,7 +393,7 @@ SphericalHarmonic::SphericalHarmonic(const std::vector<video::ITexture *> &spher
Color *float_tex_cube[6];
convertToFloatTexture(sh_rgba, sh_w, sh_h, float_tex_cube);
generateSphericalHarmonics(float_tex_cube, sh_w, m_blue_SH_coeff, m_green_SH_coeff, m_red_SH_coeff);
generateSphericalHarmonics(float_tex_cube, sh_w);
for (unsigned i = 0; i < 6; i++)
{
@@ -378,10 +401,13 @@ SphericalHarmonic::SphericalHarmonic(const std::vector<video::ITexture *> &spher
delete[] float_tex_cube[i];
}
}// SphericalHarmonic(const std::vector<video::ITexture *> &spherical_harmonics_textures)
}// SphericalHarmonics(const std::vector<video::ITexture *> &spherical_harmonics_textures)
// ----------------------------------------------------------------------------
SphericalHarmonic::SphericalHarmonic(const video::SColor &ambient)
/** When spherical harmonics textures are not defined, SH coefficents are computed
* from ambient light
*/
SphericalHarmonics::SphericalHarmonics(const video::SColor &ambient)
{
unsigned char *sh_rgba[6];
unsigned sh_w = 16;
@@ -402,7 +428,7 @@ SphericalHarmonic::SphericalHarmonic(const video::SColor &ambient)
Color *float_tex_cube[6];
convertToFloatTexture(sh_rgba, sh_w, sh_h, float_tex_cube);
generateSphericalHarmonics(float_tex_cube, sh_w, m_blue_SH_coeff, m_green_SH_coeff, m_red_SH_coeff);
generateSphericalHarmonics(float_tex_cube, sh_w);
for (unsigned i = 0; i < 6; i++)
{
@@ -418,24 +444,30 @@ SphericalHarmonic::SphericalHarmonic(const video::SColor &ambient)
m_red_SH_coeff[i] *= 4;
}
}// SphericalHarmonic(const video::SColor &ambient)
}// SphericalHarmonics(const video::SColor &ambient)
// ----------------------------------------------------------------------------
void SphericalHarmonic::printCoeff() {
Log::debug("SphericalHarmonic", "Blue_SH:");
void SphericalHarmonics::printCoeff() {
Log::debug("SphericalHarmonics", "Blue_SH:");
displayCoeff(m_blue_SH_coeff);
Log::debug("SphericalHarmonic", "Green_SH:");
Log::debug("SphericalHarmonics", "Green_SH:");
displayCoeff(m_green_SH_coeff);
Log::debug("SphericalHarmonic", "Red_SH:");
Log::debug("SphericalHarmonics", "Red_SH:");
displayCoeff(m_red_SH_coeff);
} //printCoeff
// ----------------------------------------------------------------------------
void SphericalHarmonic::unprojectSH(float *output[], size_t width, size_t height,
float *Y00[], float *Y1minus1[], float *Y10[],
float *Y11[], float *Y2minus2[], float *Y2minus1[],
float * Y20[], float *Y21[], float *Y22[])
/** Compute the the environment map from the spherical harmonics coefficients
* \param width The texture width
* \param height The texture height
* \param Yml The sphericals harmonics functions values
* \param[out] output The environment map texels values
*/
void SphericalHarmonics::unprojectSH(size_t width, size_t height,
float *Y00[], float *Y1minus1[], float *Y10[],
float *Y11[], float *Y2minus2[], float *Y2minus1[],
float *Y20[], float *Y21[], float *Y22[],
float *output[])
{
for (unsigned face = 0; face < 6; face++)
{
@@ -449,22 +481,21 @@ void SphericalHarmonic::unprojectSH(float *output[], size_t width, size_t height
output[face][4 * height * i + 4 * j + 2] =
getTexelValue(i, j, width, height, m_red_SH_coeff, Y00[face],
Y1minus1[face], Y10[face], Y11[face],
Y2minus2[face], Y2minus1[face], Y20[face],
Y21[face], Y22[face]);
Y1minus1[face], Y10[face], Y11[face],
Y2minus2[face], Y2minus1[face], Y20[face],
Y21[face], Y22[face]);
output[face][4 * height * i + 4 * j + 1] =
getTexelValue(i, j, width, height, m_green_SH_coeff, Y00[face],
Y1minus1[face], Y10[face], Y11[face],
Y2minus2[face], Y2minus1[face], Y20[face],
Y21[face], Y22[face]);
Y1minus1[face], Y10[face], Y11[face],
Y2minus2[face], Y2minus1[face], Y20[face],
Y21[face], Y22[face]);
output[face][4 * height * i + 4 * j] =
getTexelValue(i, j, width, height, m_blue_SH_coeff, Y00[face],
Y1minus1[face], Y10[face], Y11[face],
Y2minus2[face], Y2minus1[face], Y20[face],
Y21[face], Y22[face]);
Y1minus1[face], Y10[face], Y11[face],
Y2minus2[face], Y2minus1[face], Y20[face],
Y21[face], Y22[face]);
}
}
}
} // unprojectSH

View File

@@ -16,8 +16,8 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef HEADER_SPHERICAL_HARMONIC_HPP
#define HEADER_SPHERICAL_HARMONIC_HPP
#ifndef HEADER_SPHERICAL_HARMONICS_HPP
#define HEADER_SPHERICAL_HARMONICS_HPP
#include <ITexture.h>
#include <vector>
@@ -30,7 +30,7 @@ struct Color
};
class SphericalHarmonic
class SphericalHarmonics
{
private:
/** The 6 spherical harmonics textures */
@@ -41,20 +41,16 @@ private:
float m_green_SH_coeff[9];
float m_red_SH_coeff[9];
void projectSH(Color *cubemap_face[6], size_t edge_size, float *Y00[],
float *Y1minus1[], float *Y10[], float *Y11[],
float *Y2minus2[], float *Y2minus1[], float * Y20[],
float *Y21[], float *Y22[], float *blue_sh_coeff,
float *green_sh_coeff, float *red_sh_coeff);
float *Y21[], float *Y22[]);
void generateSphericalHarmonics(Color *cubemap_face[6], size_t edge_size,
float *blue_sh_coeff, float *green_sh_coeff,
float *red_sh_coeff);
void generateSphericalHarmonics(Color *cubemap_face[6], size_t edge_size);
public:
SphericalHarmonic(const std::vector<irr::video::ITexture *> &spherical_harmonics_textures);
SphericalHarmonic(const irr::video::SColor &ambient);
SphericalHarmonics(const std::vector<irr::video::ITexture *> &spherical_harmonics_textures);
SphericalHarmonics(const irr::video::SColor &ambient);
inline const float* getBlueSHCoeff () const {return m_blue_SH_coeff; }
inline const float* getGreenSHCoeff() const {return m_green_SH_coeff; }
@@ -63,10 +59,12 @@ public:
/** Print spherical harmonics coefficients (debug) */
void printCoeff();
void unprojectSH (float *output[], size_t width, size_t height,
/** Compute environment map from the spherical harmonics */
void unprojectSH (size_t width, size_t height,
float *Y00[], float *Y1minus1[], float *Y10[],
float *Y11[], float *Y2minus2[], float *Y2minus1[],
float * Y20[], float *Y21[], float *Y22[]);
float * Y20[], float *Y21[], float *Y22[],
float *output[]);
};
#endif //HEADER_SPHERICAL_HARMONIC_HPP
#endif //HEADER_SPHERICAL_HARMONICS_HPP