Raftel Engine
 
Loading...
Searching...
No Matches
Raftel::ShadowMap Class Reference

Class responsible for managing the shadow map. More...

#include <shadow.hpp>

Public Member Functions

 ShadowMap (int light_type)
 Constructor for the ShadowMap class.
 
 ~ShadowMap ()
 Destructor for the ShadowMap class.
 
 COPYABLE_AND_MOVABLE (ShadowMap)
 Macro to make the ShadowMap class movable but not copyable.
 
void BindFramebuffer ()
 Binds the framebuffer for rendering shadows.
 
void UnbindFramebuffer ()
 Unbinds the framebuffer.
 
GLuint GetDepthMap () const
 Gets the depth map texture.
 
void SetLightSpaceMatrix (const std::vector< glm::mat4 > &matrix)
 Sets the light space transformation matrices.
 
std::vector< glm::mat4 > GetLightSpaceMatrix () const
 Gets the light space transformation matrices.
 

Detailed Description

Class responsible for managing the shadow map.

The ShadowMap class handles the creation, binding, and management of a shadow map in OpenGL. It supports both point light (using cube maps) and directional light (using 2D textures). The shadow map stores depth information used for simulating shadows in a 3D scene.

Definition at line 38 of file shadow.hpp.

Constructor & Destructor Documentation

◆ ShadowMap()

Raftel::ShadowMap::ShadowMap ( int light_type)

Constructor for the ShadowMap class.

Initializes the shadow map based on the specified light type.

Parameters
light_typeThe type of light (1 for point light, other for directional light).

◆ ~ShadowMap()

Raftel::ShadowMap::~ShadowMap ( )

Destructor for the ShadowMap class.

Releases OpenGL resources associated with the shadow map.

Member Function Documentation

◆ BindFramebuffer()

void Raftel::ShadowMap::BindFramebuffer ( )

Binds the framebuffer for rendering shadows.

This function activates the framebuffer, allowing shadows to be rendered into the shadow map texture.

◆ COPYABLE_AND_MOVABLE()

Raftel::ShadowMap::COPYABLE_AND_MOVABLE ( ShadowMap )

Macro to make the ShadowMap class movable but not copyable.

This macro ensures that the ShadowMap class cannot be copied (i.e., it deletes the copy constructor and copy assignment operator), but it can be moved (i.e., the move constructor and move assignment operator are provided).

◆ GetDepthMap()

GLuint Raftel::ShadowMap::GetDepthMap ( ) const
inline

Gets the depth map texture.

Returns
The OpenGL ID of the depth map texture.

Definition at line 86 of file shadow.hpp.

◆ GetLightSpaceMatrix()

std::vector< glm::mat4 > Raftel::ShadowMap::GetLightSpaceMatrix ( ) const
inline

Gets the light space transformation matrices.

Returns
A vector of light space transformation matrices.

Definition at line 100 of file shadow.hpp.

◆ SetLightSpaceMatrix()

void Raftel::ShadowMap::SetLightSpaceMatrix ( const std::vector< glm::mat4 > & matrix)
inline

Sets the light space transformation matrices.

Parameters
matrixA vector of light space transformation matrices.

Definition at line 93 of file shadow.hpp.

◆ UnbindFramebuffer()

void Raftel::ShadowMap::UnbindFramebuffer ( )

Unbinds the framebuffer.

This function deactivates the framebuffer, restoring the default framebuffer for rendering.


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