-
Notifications
You must be signed in to change notification settings - Fork 1
/
LightSources.h
69 lines (52 loc) · 1.14 KB
/
LightSources.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
65
66
67
68
#ifndef LIGHTSOURCES_H
#define LIGHTSOURCES_H
#include <GL/glew.h>
#include <glm/glm.hpp>
#include <vector>
struct BaseLight {
glm::vec3 lightColor;
float intensity;
BaseLight() {
lightColor = glm::vec3(1.0f, 1.0f, 1.0f);
}
};
struct SpecularLight {
int intensity;
int power;
};
struct Attenuation {
float constant;
float linear;
float exponential;
Attenuation() {
constant = 0.0f;
linear = 0.0f;
exponential = 1.0f;
}
};
struct DirectionLight : public BaseLight {
glm::vec3 direction;
SpecularLight specular;
};
struct PointLight : public BaseLight {
glm::vec3 position;
Attenuation falloff;
SpecularLight specular;
};
struct SpotLight : public PointLight {
glm::vec3 direction;
float cutoff;
float hardness;
SpotLight() {
direction = glm::vec3(0.0f, 0.0f, 0.0f);
cutoff = 0.0f;
hardness = 0.0f;
}
};
struct Lights {
BaseLight ambient;
std::vector<DirectionLight*> directionalLights;
std::vector<PointLight*> pointLights;
std::vector<SpotLight*> spotLights;
};
#endif /* LIGHTSOURCES_H */