Utility class helping with environment rendering such as cube maps or spherical maps. More...
Public Member Functions | |
EnvironmentRenderer (System *system) noexcept | |
~EnvironmentRenderer () | |
void | renderCubemap (nkGraphics::Texture *output, nkGraphics::Shader *shader, unsigned int targetDimensions, nkGraphics::FORMAT targetFormat) |
void | cubemapToSphericalMap (nkGraphics::Texture *output, nkGraphics::Texture *input, unsigned int targetWidth, unsigned int targetHeight) |
Utility class helping with environment rendering such as cube maps or spherical maps.
|
noexcept |
Constructor.
system | The system the instance should live in. |
nkAstraeus::EnvironmentRenderer::~EnvironmentRenderer | ( | ) |
Destructor.
void nkAstraeus::EnvironmentRenderer::renderCubemap | ( | nkGraphics::Texture * | output, |
nkGraphics::Shader * | shader, | ||
unsigned int | targetDimensions, | ||
nkGraphics::FORMAT | targetFormat | ||
) |
Renders the given shader, into a cube map. The shader will be used 6 times as a post processing pass with properly setup cameras to render each face. The resulting texture can then be used as an enviromnent map with other materials or effects.
output | The texture to render to, which will be setup and loaded automatically by the method. |
shader | The shader to use to render each face. |
targetDimensions | The target dimensions (width and height) the output texture will be setup with. |
targetFormat | The target format the output texture will be setup with. |
void nkAstraeus::EnvironmentRenderer::cubemapToSphericalMap | ( | nkGraphics::Texture * | output, |
nkGraphics::Texture * | input, | ||
unsigned int | targetWidth, | ||
unsigned int | targetHeight | ||
) |
Converts a cube map, into a single texture, spherical map.
output | The texture to render to, which will be setup and loaded automatically by the method. |
input | The input cube map to render. |
targetWidth | The target width for the output texture. |
targetHeight | The target height for the output texture. |