-
Notifications
You must be signed in to change notification settings - Fork 0
/
Lighting.h
58 lines (48 loc) · 2.08 KB
/
Lighting.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
#ifndef _LIGHTING_H_
#define _LIGHTING_H_
#include "GLInclude.h"
//Frankie Z
class Light{
public:
//glm::vec3 lambertianShading(glm::vec3 kd, glm::vec3 id, Object o);
//Light() {}
//global ambient light
//Light(const glm::vec4&ia): i_a(ia) {}//only requires one intensity
//directional
//Light(const glm::vec3& d, const glm::vec4& ia, const glm::vec4& id,
// const glm::vec4& is): direction(d), i_a(ia), i_d(id), i_s(is) {}//linear attenuation always have value of 1
//point light
Light(const glm::vec3& p, const glm::vec4& ia, const glm::vec4& id, const glm::vec4& is, const glm::vec3& attenconst): point(p), i_a(ia), i_d(id), i_s(is), LAC(attenconst) {}//angluar attenuation always has value of 1
//spotlight
//Light(const glm::vec3& p, const glm::vec3& d, const float t, const glm::vec4& ia, const glm::vec4& id, const glm::vec4& is, const glm::vec3& attenconst, const float a): point(p), direction(d), theta(t), i_a(ia), i_d(id), i_s(is), LAC(attenconst), attenuation(a) {} // a is angular attenuation constant
const glm::vec3& getPoint()const{
return point;
}
const glm::vec4& getIa()const{
return i_a;
}
const glm::vec4& getId()const{
return i_d;
}
const glm::vec4& getIs()const {
return i_s;
}
const glm::vec3& getLAC()const{
return LAC;
}
private:
glm::vec3 point;
//light intensities for Ambient diffuse & specuar components
glm::vec3 direction;
float theta;//cut off angle
glm::vec3 LAC;//linearattenuation constants
float attenuation;
glm::vec4 i_a;
glm::vec4 i_d;
glm::vec4 i_s;
//glm::vec3 lambertianShading(glm::vec3 kd, glm::vec3 id, Object o);
//glm::vec3 calculateDirection(const glm::vec3& p, const glm::vec3& x);
//glm::vec3 lambertianShading(Ray x, Plane o);
//glm::vec3 blinPhongShading(Ray x, Plane o, Material m, Camera c);
};
#endif