-
Notifications
You must be signed in to change notification settings - Fork 5
/
ryan_light.h
59 lines (47 loc) · 1.28 KB
/
ryan_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
#ifndef RYAN_LIGHT
#define RYAN_LIGHT
#include "ryan_vector.h"
#include "ryan_matrix.h"
class Light {
public:
Vector4f position;
Vector4f ambient;
Vector4f diffuse;
Vector4f specular;
Vector4f lookAtPoint;
GLfloat angularAtten;
GLfloat coneAngle;
Light() {
this->position = Vector4f(0, 0, 0, 0);
this->ambient = Vector4f(0, 0, 0, 0);
this->diffuse = Vector4f(0, 0, 0, 0);
this->specular = Vector4f(0, 0, 0, 0);
// Used only for spotlights
this->lookAtPoint = Vector4f(0, 0, 0, 0);
this->angularAtten = 23;
this->coneAngle = 35;
}
void setAmbient(GLfloat r, GLfloat g, GLfloat b) {
this->ambient = Vector4f(r, g, b, 0.0);
}
void setDiffuse(GLfloat r, GLfloat g, GLfloat b) {
this->diffuse = Vector4f(r, g, b, 0.0);
}
void setSpecular(GLfloat r, GLfloat g, GLfloat b) {
this->specular = Vector4f(r, g, b, 0.0);
}
void setPosition(GLfloat x, GLfloat y, GLfloat z) {
this->position = Vector4f(x, y, z, 0);
}
// Below are properties only used for spotlights
void setLookAtPoint(GLfloat x, GLfloat y, GLfloat z) {
this->lookAtPoint = Vector4f(x, y, z, 0);
}
void setAngularAttenuation(GLfloat att) {
this->angularAtten = att;
}
void setConeAngle(GLfloat angle) {
this->coneAngle = angle;
}
};
#endif