-
Notifications
You must be signed in to change notification settings - Fork 0
/
light.h
62 lines (45 loc) · 1.22 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
#ifndef LIGHT_H
#define LIGHT_H
#include <vector>
#include "GLWidget.h"
using std::vector;
enum LIGHT_TYPE
{
LIGHT_SPOT,
LIGHT_POINT,
LIGHT_DIRECTIONAL
};
class Light
{
public:
static void Initialize(void);
Light(LIGHT_TYPE lightType);
~Light();
void Visible(bool value = true);
void setDiffuse(float r, float g, float b, float a);
void setAmbient(float r, float g, float b, float a);
void setSpecular(float r, float g, float b, float a);
void setLightType(LIGHT_TYPE lightType);
void setPosition(float x, float y, float z);
void setSpotDirection(float x, float y, float z);
void setCutoff(float value);
void setExponent(float value);
void setAttenuation(float constant, float linear, float quadratic);
int getLightNum(void);
void updateLight(void);
static int numLights;
static vector<int> availableLights;
static vector<Light*> lights;
private:
GLfloat position[4];
GLfloat diffuse[4];
GLfloat ambient[4];
GLfloat specular[4];
GLfloat spotDirection[4];
float cutoff;
float exponent;
bool visible;
int lightType;
int lightNum;
};
#endif // LIGHT_H