CG-Project2
Loading...
Searching...
No Matches
Utils.hpp
1#pragma once
2
3#include <glm/glm.hpp>
4#include <string>
5
12namespace light {
19 enum LightType {
20 LIGHT_DIRECTIONAL,
21 LIGHT_POINT,
22 LIGHT_SPOT,
23 };
24} // namespace light
25
26// REMOVE THIS LINE
27using namespace light;
28
29#define SHADER_MAX_LIGHTS 32
30
36 float constant = 1.f;
38 float linear = .09f;
40 float quadratic = .032f;
41};
42
48 glm::vec3 ambient{.1f, .1f, .1f};
50 glm::vec3 diffuse{.8f, .8f, .8f};
52 glm::vec3 specular{1, 1, 1};
53};
54
56 int type = LightType::LIGHT_DIRECTIONAL;
57 float intensity = 1;
58 glm::vec3 color{1, 1, 1};
59
60 glm::vec3 position{};
61 glm::vec3 direction{};
62
63 glm::vec3 ambient{.1f, .1f, .1f};
64 glm::vec3 diffuse{.8f, .8f, .8f};
65 glm::vec3 specular{1, 1, 1};
66
67 float constant = 1;
68 float linear = .09f;
69 float quadratic = .032f;
70
71 float cutoff = 12.5f;
72 float outerCutoff = 17.5f;
73
74 bool isSmooth = false;
75};
76
77enum LightComputation {
78 NONE,
79 PHONG,
80 BLINN_PHONG,
81 INT_PHONG,
82 INT_BLINN_PHONG,
83};
84
85unsigned char *readImageData(const std::string &path, int &width, int &height, int &nrChannels, int desiredChannels = 0);
86
87void flipImagesVertically(const bool &val);
88
89void freeImageData(void *data);
Definition Component.hpp:552
LightType
Lights type used in shader programs.
Definition Utils.hpp:19
Lights attenuation data structure.
Definition Utils.hpp:34
float quadratic
light quadratic value
Definition Utils.hpp:40
float linear
light linear value
Definition Utils.hpp:38
float constant
light constant value
Definition Utils.hpp:36
Definition Utils.hpp:55
Light vectors for light component.
Definition Utils.hpp:46
glm::vec3 specular
light specular vector
Definition Utils.hpp:52
glm::vec3 diffuse
light diffuse vector
Definition Utils.hpp:50
glm::vec3 ambient
light ambient vector
Definition Utils.hpp:48