-
Notifications
You must be signed in to change notification settings - Fork 1
/
Light.h
executable file
·124 lines (101 loc) · 2.28 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#pragma once
#include "vec4.h"
#include "mat4.h"
typedef enum
{
LIGHT_ID_AMBIENT=-1,
LIGHT_ID_1=0,
LIGHT_ID_2,
LIGHT_ID_3,
LIGHT_ID_4,
LIGHT_ID_5,
LIGHT_ID_6,
LIGHT_ID_7,
LIGHT_ID_8,
MAX_LIGHT
} LightID;
typedef enum
{
LIGHT_TYPE_DIRECTIONAL,
LIGHT_TYPE_POINT,
LIGHT_TYPE_SPOT
} LightType;
typedef enum
{
LIGHT_SPACE_VIEW,
LIGHT_SPACE_LOCAL
} LightSpace;
class LightParams
{
public:
//light enabled
bool enabled;
//type directional,point,spot
LightType type;
//local or view space
LightSpace space;
//color 0-255 RGB
int colorR;
int colorG;
int colorB;
//position
double posX;
double posY;
double posZ;
vec4 rel_pos;
//direction
double dirX;
double dirY;
double dirZ;
double* z_array_xdir;
double* z_array_neg_xdir;
double* z_array_ydir;
double* z_array_neg_ydir;
double* z_array_zdir;
double* z_array_neg_zdir;
mat4 transpose;
mat4 coord_system_x;
mat4 coord_system_neg_x;
mat4 coord_system_y;
mat4 coord_system_neg_y;
mat4 coord_system_z;
mat4 coord_system_neg_z;
mat4 light_transform;
vec4 rel_dir;
LightParams():
enabled(false),type(LIGHT_TYPE_DIRECTIONAL),space(LIGHT_SPACE_VIEW),
colorR(255),colorG(255),colorB(255),posX(0),posY(0),posZ(0),
dirX(0),dirY(0),dirZ(0)
{
transpose[0][0] = 1;
transpose[1][1] = 1;
transpose[2][2] = 1;
transpose[3][3] = 1;
coord_system_z[0][0] = -1;
coord_system_z[1][1] = 1;
coord_system_z[2][2] = -1;
coord_system_z[3][3] = 1;
coord_system_neg_z[0][0] = 1;
coord_system_neg_z[1][1] = 1;
coord_system_neg_z[2][2] = 1;
coord_system_neg_z[3][3] = 1;
coord_system_y[0][0] = 1;
coord_system_y[1][2] = -1;
coord_system_y[2][1] = 1;
coord_system_y[3][3] = 1;
coord_system_neg_y[0][0] = 1;
coord_system_neg_y[1][2] = 1;
coord_system_neg_y[2][1] = -1;
coord_system_neg_y[3][3] = 1;
coord_system_x[0][2] = -1;
coord_system_x[1][1] = 1;
coord_system_x[2][0] = 1;
coord_system_x[3][3] = 1;
coord_system_neg_x[0][2] = 1;
coord_system_neg_x[1][1] = 1;
coord_system_neg_x[2][0] = -1;
coord_system_neg_x[3][3] = 1;
}
protected:
private:
};