|
Visual Computing Library
devel
|
A class representing an environment for PBR rendering. More...
#include <vclib/bgfx/drawable/drawable_environment.h>
Public Types | |
| enum class | TextureType { RAW_CUBE , IRRADIANCE , SPECULAR , BRDF_LUT } |
| Types of environment textures managed by the DrawableEnvironment class. | |
Public Member Functions | |
| void | bindTexture (TextureType type, uint stage, uint samplerFlags=BGFX_SAMPLER_UVW_CLAMP) const |
| Binds the specified environment texture to the given texture stage. | |
| bool | canDraw () const |
| Checks if the environment is ready to be drawn. | |
| DrawableEnvironment (const DrawableEnvironment &other)=delete | |
| DrawableEnvironment (const std::string &imagePath, uint viewId=UINT_NULL) | |
| DrawableEnvironment (DrawableEnvironment &&other) | |
| void | drawBackground (uint viewId, const PBRViewerSettings &settings) const |
| Draws the environment in the background. | |
| std::string | imageFileName () const |
| const std::string & | imagePath () const |
| DrawableEnvironment & | operator= (const DrawableEnvironment &other)=delete |
| DrawableEnvironment & | operator= (DrawableEnvironment &&other) |
| uint8_t | specularMipLevels () const |
| void | swap (DrawableEnvironment &other) |
Private Types | |
| enum class | FileFormat { UNKNOWN , HDR , EXR , KTX , DDS } |
Private Member Functions | |
| void | generateTextures (const bimg::ImageContainer &image, uint cubeSide, uint8_t cubeMips, uint viewId) |
| Generates the necessary environment textures (cubemap, irradiance map, specular map, BRDF LUT). | |
| FileFormat | getFileFormat (const std::string &imagePath) |
| Determines the file format of the given image based on its extension. | |
| bimg::ImageContainer * | loadImage (std::string imagePath) |
| Loads the image from the specified file path. | |
| void | setAndGenerateTextures (const bimg::ImageContainer &image, uint viewId) |
| Sets up the environment textures based on the given image. | |
Static Private Member Functions | |
| static vcl::VertexBuffer | fullScreenTriangle () |
| Sets and returns the buffer for the full-screen triangle for background drawing. | |
Private Attributes | |
| Texture | mBrdfLuTexture |
| const Uniform | mBrdfLutSamplerUniform |
| Texture | mCubeMapTexture |
| const Uniform | mEnvCubeSamplerUniform |
| const Uniform | mHdrSamplerUniform |
| Texture | mHdrTexture |
| std::string | mImagePath |
| const Uniform | mIrradianceCubeSamplerUniform |
| Texture | mIrradianceTexture |
| const Uniform | mSpecularCubeSamplerUniform |
| uint8_t | mSpecularMipLevels = 0 |
| Texture | mSpecularTexture |
| const vcl::VertexBuffer | mVertexBuffer = fullScreenTriangle() |
Static Private Attributes | |
| static const uint | BRDF_LU_TEXTURE_SIZE = 1024 |
Friends | |
| void | swap (DrawableEnvironment &first, DrawableEnvironment &second) |
A class representing an environment for PBR rendering.
It manages the loading and setup of environment maps, including HDR images, cubemaps, irradiance maps, specular maps, and BRDF LUTs.
| void vcl::DrawableEnvironment::bindTexture | ( | TextureType | type, |
| uint | stage, | ||
| uint | samplerFlags = BGFX_SAMPLER_UVW_CLAMP |
||
| ) | const |
Binds the specified environment texture to the given texture stage.
| [in] | type | The type of texture to bind (RAW_CUBE, IRRADIANCE, SPECULAR, BRDF_LUT). |
| [in] | stage | The texture stage to bind the texture to. |
| [in] | samplerFlags | The sampler flags to use when binding the texture. |
|
inline |
Checks if the environment is ready to be drawn.
| void vcl::DrawableEnvironment::drawBackground | ( | uint | viewId, |
| const PBRViewerSettings & | settings | ||
| ) | const |
Draws the environment in the background.
| [in] | viewId | The view ID to draw the background in. |
| [in] | settings | The tone mapping operator to use. |
|
private |
Generates the necessary environment textures (cubemap, irradiance map, specular map, BRDF LUT).
This function is called by setAndGenerateTextures after setting up the initial textures.
|
private |
Determines the file format of the given image based on its extension.
Recognized formats are HDR, EXR, KTX, DDS otherwise the format is marked as UNKNOWN.
| [in] | imagePath | The path to the image file. |
|
private |
Loads the image from the specified file path.
| [in] | imagePath | The path to the image file. |
|
private |
Sets up the environment textures based on the given image.
This function is called in the constructor after loading the image.
| [in] | image | The image container holding the environment map data. |