Raftel Engine
 
Loading...
Searching...
No Matches
shadow.hpp
Go to the documentation of this file.
1
14
15
16#ifndef __SHADOW_HPP__
17#define __SHADOW_HPP__ 1
18
19#include <GL/glew.h>
20#include "glm/mat4x4.hpp"
21#include "raftel/global_macros.hpp"
22#include <vector>
23
24
25#define SHADOW_WIDTH 1024
26#define SHADOW_HEIGHT 1024
27
28namespace Raftel {
38 class ShadowMap {
39 public:
40
47 ShadowMap(int light_type);
48
55
64
72
80
86 GLuint GetDepthMap() const { return depthMap; }
87
93 void SetLightSpaceMatrix(const std::vector<glm::mat4>& matrix) { lightSpaceMatrix = matrix; }
94
100 std::vector<glm::mat4> GetLightSpaceMatrix() const { return lightSpaceMatrix; }
101
102 private:
103 GLuint depthMapFBO = 0;
104 GLuint depthMap = 0;
105 std::vector<glm::mat4> lightSpaceMatrix;
106
114 void Initialize(int light_type);
115
119 void ReleaseResources();
120 };
121} // namespace Raftel
122#endif // !__SHADOW_HPP__
COPYABLE_AND_MOVABLE(ShadowMap)
Macro to make the ShadowMap class movable but not copyable.
void SetLightSpaceMatrix(const std::vector< glm::mat4 > &matrix)
Sets the light space transformation matrices.
Definition shadow.hpp:93
~ShadowMap()
Destructor for the ShadowMap class.
void BindFramebuffer()
Binds the framebuffer for rendering shadows.
ShadowMap(int light_type)
Constructor for the ShadowMap class.
GLuint GetDepthMap() const
Gets the depth map texture.
Definition shadow.hpp:86
void UnbindFramebuffer()
Unbinds the framebuffer.
std::vector< glm::mat4 > GetLightSpaceMatrix() const
Gets the light space transformation matrices.
Definition shadow.hpp:100