Radium Engine
1.5.20
|
Defines a spherical, infinite light sources and, optionally, sky boxes. An operator to convert an EnvironmentTexture to SH matrices for irradiance mapping is defined. An operator to draw a textured sky box is defined. More...
#include <Engine/Data/EnvironmentTexture.hpp>
Public Types | |
enum class | EnvMapType { ENVMAP_PFM , ENVMAP_CUBE , ENVMAP_LATLON } |
Environment map type inferred from file names and format. Supported environment type. More... | |
Public Member Functions | |
const std::string & | getImageName () const |
Get the name used to construct the environment texture. | |
EnvMapType | getImageType () const |
Get the type of the environment texture. | |
void | saveShProjection (const std::string &filename) |
Saves the spherical image representing the SH-encoded envmap. | |
const Ra::Core::Matrix4 & | getShMatrix (int channel) |
Return the SH Matrix corresponding to the given color channel. The SH matrix is computed according to the paper An Efficient Representation for Irradiance Environment Maps, Ramamoorthi, Ravi and Hanrahan, Pat SIGGRAPH 2001 https://doi.org/10.1145/383259.383317. | |
void | render (const Ra::Engine::Data::ViewingParameters &viewParams) |
Render the envmap as a textured cube. This method does nothing if the envmap is not a skybox. | |
void | setSkybox (bool state) |
Set the state of the skybox. | |
void | setStrength (float s) |
Set the multiplicative factor which defined the power of the light source. | |
float | getStrength () const |
Get the multiplicative factor which defined the power of the light source. | |
bool | isSkybox () const |
Ra::Engine::Data::Texture * | getEnvironmentTexture () |
void | updateGL () |
Update the OpenGL state of the envmap : texture, skybox and shaders if needed. | |
EnvironmentTexture (const std::string &mapName, bool isSkybox=false) | |
Construct an envmap from a file. Supported image component of the envmap are the following. | |
EnvironmentTexture (const EnvironmentTexture &)=delete | |
EnvironmentTexture & | operator= (const EnvironmentTexture &)=delete |
EnvironmentTexture (EnvironmentTexture &&)=default | |
EnvironmentTexture & | operator= (EnvironmentTexture &&)=default |
~EnvironmentTexture ()=default | |
destructor | |
Defines a spherical, infinite light sources and, optionally, sky boxes. An operator to convert an EnvironmentTexture to SH matrices for irradiance mapping is defined. An operator to draw a textured sky box is defined.
Definition at line 19 of file EnvironmentTexture.hpp.
|
strong |
Environment map type inferred from file names and format. Supported environment type.
Definition at line 31 of file EnvironmentTexture.hpp.
|
explicit |
Construct an envmap from a file. Supported image component of the envmap are the following.
Constructors and destructor follow the 'rule of five' https://en.cppreference.com/w/cpp/language/rule_of_three
mapName | The list of filenames |
type | The file type. Supported file types are PFM for single files or whatever is supported by stb for per-face files. |
isSkybox | indicates if the envmap must be associated with a skybox and rendered like this. |
Definition at line 146 of file EnvironmentTexture.cpp.
Ra::Engine::Data::Texture * Ra::Engine::Data::EnvironmentTexture::getEnvironmentTexture | ( | ) |
Definition at line 732 of file EnvironmentTexture.cpp.
|
inline |
Get the name used to construct the environment texture.
Definition at line 78 of file EnvironmentTexture.hpp.
|
inline |
Get the type of the environment texture.
Definition at line 84 of file EnvironmentTexture.hpp.
const Ra::Core::Matrix4 & Ra::Engine::Data::EnvironmentTexture::getShMatrix | ( | int | channel | ) |
Return the SH Matrix corresponding to the given color channel. The SH matrix is computed according to the paper An Efficient Representation for Irradiance Environment Maps, Ramamoorthi, Ravi and Hanrahan, Pat SIGGRAPH 2001 https://doi.org/10.1145/383259.383317.
channel | The number of the color channel (red = 0, green = 1, blue = 2) |
Definition at line 649 of file EnvironmentTexture.cpp.
float Ra::Engine::Data::EnvironmentTexture::getStrength | ( | ) | const |
Get the multiplicative factor which defined the power of the light source.
Definition at line 728 of file EnvironmentTexture.cpp.
|
inline |
Definition at line 132 of file EnvironmentTexture.hpp.
void Ra::Engine::Data::EnvironmentTexture::render | ( | const Ra::Engine::Data::ViewingParameters & | viewParams | ) |
Render the envmap as a textured cube. This method does nothing if the envmap is not a skybox.
viewParams | The viewing parameter used to draw the scene |
Definition at line 695 of file EnvironmentTexture.cpp.
void Ra::Engine::Data::EnvironmentTexture::saveShProjection | ( | const std::string & | filename | ) |
Saves the spherical image representing the SH-encoded envmap.
filename | the file to write, in any format supported by stb library |
Definition at line 643 of file EnvironmentTexture.cpp.
|
inline |
Set the state of the skybox.
state | true to enable skybox rendering, false to just use the SH coefficients |
Definition at line 115 of file EnvironmentTexture.hpp.
void Ra::Engine::Data::EnvironmentTexture::setStrength | ( | float | s | ) |
Set the multiplicative factor which defined the power of the light source.
s | the envmap power |
Definition at line 724 of file EnvironmentTexture.cpp.
void Ra::Engine::Data::EnvironmentTexture::updateGL | ( | ) |
Update the OpenGL state of the envmap : texture, skybox and shaders if needed.
Definition at line 653 of file EnvironmentTexture.cpp.