|
lmgl 1.0.0
A lightweight OpenGL graphics engine library written in C++
|
Manages a cubemap depth texture for rendering shadows from point lights. More...
#include <shadow_map.hpp>
Public Member Functions | |
| CubemapShadowMap (unsigned int resolution=1024) | |
| Constructs a CubemapShadowMap with the specified resolution. | |
| ~CubemapShadowMap () | |
| Destructor for CubemapShadowMap. | |
| void | bind (unsigned int face) |
| Binds the framebuffer object for rendering to a specific face of the cubemap shadow map. | |
| void | unbind () |
| Unbinds the framebuffer object, returning to the default framebuffer. | |
| void | bind_texture (unsigned int slot=0) const |
| Binds the cubemap depth texture to the specified texture slot for use in shaders. | |
| unsigned int | get_texture_id () const |
| Returns the OpenGL texture ID of the cubemap depth texture. | |
| unsigned int | get_resolution () const |
| Returns the resolution of each face of the cubemap shadow map. | |
Manages a cubemap depth texture for rendering shadows from point lights.
This class encapsulates the creation and management of a framebuffer object (FBO) and a cubemap depth texture used for shadow mapping with point lights. It provides methods to bind and unbind the FBO, bind the cubemap depth texture for use in shaders, and retrieve the texture ID and resolution.
| lmgl::renderer::CubemapShadowMap::CubemapShadowMap | ( | unsigned int | resolution = 1024 | ) |
Constructs a CubemapShadowMap with the specified resolution.
Creates a framebuffer object and a cubemap depth texture for shadow mapping.
| resolution | The resolution of each face of the cubemap shadow map. Default is 1024. |
| void lmgl::renderer::CubemapShadowMap::bind | ( | unsigned int | face | ) |
Binds the framebuffer object for rendering to a specific face of the cubemap shadow map.
This method binds the FBO so that subsequent rendering commands will write depth information to the specified face of the cubemap shadow map texture.
| face | The index of the cubemap face to bind (0-5). |
unbind method. | void lmgl::renderer::CubemapShadowMap::bind_texture | ( | unsigned int | slot = 0 | ) | const |
Binds the cubemap depth texture to the specified texture slot for use in shaders.
This method binds the cubemap depth texture so that it can be sampled in shaders for shadow calculations.
| slot | The texture slot to bind the cubemap depth texture to. Default is 0. |
|
inline |
Returns the resolution of each face of the cubemap shadow map.
|
inline |
Returns the OpenGL texture ID of the cubemap depth texture.
| void lmgl::renderer::CubemapShadowMap::unbind | ( | ) |
Unbinds the framebuffer object, returning to the default framebuffer.
This method should be called after rendering to the cubemap shadow map is complete. It restores rendering to the default framebuffer.