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 visibility_state { |
12 |
unsigned int generation; |
13 |
enum { UNKNOWN, OCCLUDED, PARTIAL, FULL } visibility; |
14 |
|
15 |
visibility_state () : generation(0), visibility(UNKNOWN) { }; |
16 |
}; |
17 |
|
18 |
struct view { |
19 |
sector orig; |
20 |
point p; |
21 |
vec3 d, u; |
22 |
GLfloat fov; |
23 |
GLfloat near, far; |
24 |
int w, h; |
25 |
|
26 |
GLfloat gamma; |
27 |
|
28 |
// only to be used by friends TODO |
29 |
|
30 |
GLfloat nextfar; |
31 |
|
32 |
matrix projection; |
33 |
|
34 |
struct { |
35 |
plane l, r, t, b, n, f; |
36 |
} frustum; |
37 |
|
38 |
enum mode { DEPTH, LIGHTED } mode; |
39 |
light *l; |
40 |
set<const entity *> drawn; |
41 |
|
42 |
unsigned int generation; |
43 |
map<octant *, visibility_state> vismap; |
44 |
vector<octant *> vislist; // octants partially or fully visible in frustum |
45 |
vector<octant *> farlist; // octants possibly visible |
46 |
vector<octant *> occlist; // octants currently occluded |
47 |
|
48 |
void reset_projection (); |
49 |
|
50 |
// public |
51 |
|
52 |
void begin (); |
53 |
void pass (enum mode m); |
54 |
void end (); |
55 |
|
56 |
bool may_draw (const entity *e); |
57 |
|
58 |
view (); |
59 |
~view (); |
60 |
}; |
61 |
|
62 |
#endif |
63 |
|