-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLight.h
64 lines (53 loc) · 1.48 KB
/
Light.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef LIGHT_H
#define LIGHT_H
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include "Shader.h"
/**
* @brief Class to describe the light source
*/
class Light {
glm::vec3 position;
glm::vec3 color;
glm::vec3 target;
GLuint depthMap{0};
glm::mat4 model;
public:
bool isEnabled;
glm::mat4 proj_view;
/**
* @brief Constructor for the class
* @param position The position of the light source
* @param color RGB color of the light source
* @param target The point light source are trying to be focused on
*/
Light(const glm::vec3 &position, const glm::vec3 &color, const glm::vec3 &target = {0, 0, 0});
/**
* @brief Method to generate the depth map
* @param resolution The resolution of the map
*/
void genDepthMap(unsigned int resolution);
/**
* @brief Method to get the position of the light source
*/
[[nodiscard]] const glm::vec3 &getPosition() const;
/**
* @brief Method to returm the color of the light
*/
[[nodiscard]] const glm::vec3 &getColor() const;
/**
* @brief Method to get the depth map
*/
[[nodiscard]] GLuint getDepthMap() const;
/**
* @brief Method to get the model matrix
*/
[[nodiscard]] const glm::mat4 &getModel() const;
/**
* @brief Method to get the view matrix from light source's point of view
*/
[[nodiscard]] glm::mat4 lookAt() const;
};
#endif