AireEngine
A 3D Open-World Game Engine
Loading...
Searching...
No Matches
shadows.h
1#pragma once
2
3#include <glad/glad.h>
4#include <glm/glm.hpp>
5#include <vector>
6#include <glm/gtc/matrix_transform.hpp>
7#include "../res-management/light.h"
8
9namespace Aire {
10
15 {
16 public:
24 PointShadows(const GLuint shaderProg, const std::vector<Light>& lights, GLuint width = 4096, GLuint height = 4096);
25
30
31 GLuint FBO;
32 const GLuint width, height;
33 GLuint shaderProg;
34 std::vector<Light> lights;
35 std::vector<unsigned int> depthCubemaps;
36 std::vector<std::vector<glm::mat4>> shadowTransforms;
37 const float farPlane = 25.0f;
39 private:
40 const float nearPlane = 1.0f;
45 void init();
46
50 void calculateShadowTransforms();
51 };
52
57 {
58 public:
66 DirectionalShadows(const GLuint shaderProg, Light light, GLuint width = 4096, GLuint height = 4096);
67
72
73 GLuint FBO;
74 const GLuint width, height;
75 GLuint shaderProg;
76 GLuint depthMap;
77 glm::mat4 lightSpaceMatrix;
79 private:
80 Light directionalLight;
85 void init();
86 };
87}
Class to handle directional light shadows using shadow mapping with a depth map.
Definition shadows.h:57
GLuint shaderProg
Definition shadows.h:75
DirectionalShadows(const GLuint shaderProg, Light light, GLuint width=4096, GLuint height=4096)
Constructor for DirectionalShadows.
Definition shadows.cpp:69
GLuint depthMap
Definition shadows.h:76
const GLuint height
Definition shadows.h:74
~DirectionalShadows()
Destructor for DirectionalShadows.
Definition shadows.cpp:80
GLuint FBO
Definition shadows.h:73
glm::mat4 lightSpaceMatrix
Definition shadows.h:77
Class to handle point light shadows using shadow mapping with cubemaps.
Definition shadows.h:15
std::vector< Light > lights
Definition shadows.h:34
std::vector< unsigned int > depthCubemaps
Definition shadows.h:35
std::vector< std::vector< glm::mat4 > > shadowTransforms
Definition shadows.h:36
~PointShadows()
Destructor for PointShadows.
Definition shadows.cpp:16
const GLuint height
Definition shadows.h:32
GLuint shaderProg
Definition shadows.h:33
PointShadows(const GLuint shaderProg, const std::vector< Light > &lights, GLuint width=4096, GLuint height=4096)
Constructor for PointShadows.
Definition shadows.cpp:9
const float farPlane
Definition shadows.h:37
GLuint FBO
Definition shadows.h:31
A point light.
Definition light.h:7