lmgl 1.0.0
A lightweight OpenGL graphics engine library written in C++
Loading...
Searching...
No Matches
lmgl::renderer::CubemapShadowMap Class Reference

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.
 

Detailed Description

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.

Note
The default resolution is set to 1024x1024 pixels per face.

Constructor & Destructor Documentation

◆ CubemapShadowMap()

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.

Parameters
resolutionThe resolution of each face of the cubemap shadow map. Default is 1024.

Member Function Documentation

◆ bind()

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.

Parameters
faceThe index of the cubemap face to bind (0-5).
Note
Make sure to unbind the FBO after rendering using the unbind method.

◆ bind_texture()

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.

Parameters
slotThe texture slot to bind the cubemap depth texture to. Default is 0.

◆ get_resolution()

unsigned int lmgl::renderer::CubemapShadowMap::get_resolution ( ) const
inline

Returns the resolution of each face of the cubemap shadow map.

Returns
The resolution of each face in pixels.

◆ get_texture_id()

unsigned int lmgl::renderer::CubemapShadowMap::get_texture_id ( ) const
inline

Returns the OpenGL texture ID of the cubemap depth texture.

Returns
The texture ID of the cubemap depth texture.

◆ unbind()

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.


The documentation for this class was generated from the following files: