… | |
… | |
7 | |
7 | |
8 | using namespace std; |
8 | using namespace std; |
9 | |
9 | |
10 | #include "util.h" |
10 | #include "util.h" |
11 | #include "event.h" |
11 | #include "event.h" |
|
|
12 | #include "shader.h" |
12 | |
13 | |
13 | struct visibility_base |
14 | struct visibility_base |
14 | { |
15 | { |
15 | unsigned int generation; // freshness check |
16 | unsigned int generation; // freshness check |
16 | }; |
17 | }; |
… | |
… | |
34 | |
35 | |
35 | struct pass |
36 | struct pass |
36 | { |
37 | { |
37 | struct light *l; |
38 | struct light *l; |
38 | |
39 | |
|
|
40 | typedef map<struct material *, shader::program_object> matmap_t; |
|
|
41 | matmap_t matmap; |
|
|
42 | |
39 | pass (light *l) : l(l) { } |
43 | pass (light *l) : l(l) { } |
40 | }; |
44 | }; |
41 | |
45 | |
42 | extern pass pass_depth; |
46 | extern pass pass_depth; // the standard depth pass |
43 | |
47 | |
44 | struct view |
48 | struct view |
45 | { |
49 | { |
46 | sector orig; |
50 | sector orig; |
47 | point p; |
51 | point p; |
… | |
… | |
110 | ~view (); |
114 | ~view (); |
111 | }; |
115 | }; |
112 | |
116 | |
113 | struct light : view |
117 | struct light : view |
114 | { |
118 | { |
|
|
119 | shader::uniform_4f lightpos; |
|
|
120 | |
|
|
121 | // vertex shader |
|
|
122 | virtual void vsh () = 0; |
|
|
123 | // fragment shader |
|
|
124 | virtual shader::temp_3f operator ()() = 0; |
|
|
125 | |
|
|
126 | virtual void enable (); |
|
|
127 | virtual void disable (); |
|
|
128 | }; |
|
|
129 | |
|
|
130 | struct linear_light : light |
|
|
131 | { |
115 | colour c; |
132 | colour c; |
116 | GLfloat intensity; |
133 | GLfloat intensity; |
117 | GLfloat radius; |
134 | GLfloat radius; |
|
|
135 | |
|
|
136 | void vsh (); |
|
|
137 | shader::temp_3f operator ()(); |
118 | }; |
138 | }; |
119 | |
139 | |
120 | #endif |
140 | #endif |
121 | |
141 | |