1 |
#ifndef VIEW_H |
2 |
#define VIEW_H |
3 |
|
4 |
#include <set> |
5 |
#include <map> |
6 |
|
7 |
using namespace std; |
8 |
|
9 |
#include "util.h" |
10 |
|
11 |
struct view { |
12 |
sector orig; |
13 |
point p; |
14 |
vec3 d, u; |
15 |
float fov; |
16 |
int w, h; |
17 |
|
18 |
void draw (draw_context &ctx); |
19 |
}; |
20 |
|
21 |
struct visibility_state { |
22 |
unsigned int generation; |
23 |
enum { UNKNOWN, TESTING, PARTIAL, FULL } visibility; |
24 |
|
25 |
visibility_state () : generation(0), visibility(UNKNOWN) { }; |
26 |
}; |
27 |
|
28 |
struct draw_context { |
29 |
view &v; |
30 |
|
31 |
gl_matrix projection; |
32 |
struct { |
33 |
plane l, r, t, b, n, f; |
34 |
} frustum; |
35 |
enum { DEPTH, LIGHTED } mode; |
36 |
light *l; |
37 |
set<entity_base *> drawn; |
38 |
|
39 |
unsigned int generation; |
40 |
map<octant *, visibility_state> vismap; |
41 |
vector<octant *> vislist; |
42 |
|
43 |
bool may_draw (entity_base *e); |
44 |
|
45 |
draw_context (view &v); |
46 |
~draw_context (); |
47 |
}; |
48 |
|
49 |
#endif |
50 |
|