1 |
root |
1.1 |
#ifndef VIEW_H |
2 |
|
|
#define VIEW_H |
3 |
|
|
|
4 |
|
|
#include <set> |
5 |
root |
1.4 |
#include <map> |
6 |
root |
1.1 |
|
7 |
|
|
using namespace std; |
8 |
|
|
|
9 |
|
|
#include "util.h" |
10 |
|
|
|
11 |
root |
1.12 |
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 |
root |
1.2 |
struct view { |
19 |
|
|
sector orig; |
20 |
|
|
point p; |
21 |
|
|
vec3 d, u; |
22 |
root |
1.13 |
GLfloat fov; |
23 |
|
|
GLfloat near, far; |
24 |
root |
1.2 |
int w, h; |
25 |
|
|
|
26 |
root |
1.13 |
GLfloat gamma; |
27 |
root |
1.4 |
|
28 |
root |
1.12 |
// only to be used by friends TODO |
29 |
root |
1.5 |
|
30 |
root |
1.13 |
GLfloat nextfar; |
31 |
|
|
|
32 |
root |
1.8 |
matrix projection; |
33 |
root |
1.9 |
|
34 |
root |
1.11 |
void transform (const matrix &m); |
35 |
|
|
|
36 |
root |
1.5 |
struct { |
37 |
|
|
plane l, r, t, b, n, f; |
38 |
|
|
} frustum; |
39 |
root |
1.13 |
enum mode { DEPTH, LIGHTED } mode; |
40 |
root |
1.1 |
light *l; |
41 |
|
|
set<entity_base *> drawn; |
42 |
root |
1.4 |
|
43 |
|
|
unsigned int generation; |
44 |
|
|
map<octant *, visibility_state> vismap; |
45 |
root |
1.6 |
vector<octant *> vislist; // octants partially or fully visible |
46 |
|
|
vector<octant *> checklist; // octants possibly visible |
47 |
root |
1.13 |
|
48 |
|
|
void reset_projection (); |
49 |
|
|
|
50 |
|
|
// public |
51 |
|
|
|
52 |
|
|
void begin (); |
53 |
|
|
void pass (enum mode m); |
54 |
|
|
void end (); |
55 |
root |
1.1 |
|
56 |
|
|
bool may_draw (entity_base *e); |
57 |
|
|
|
58 |
root |
1.12 |
view (); |
59 |
|
|
~view (); |
60 |
root |
1.1 |
}; |
61 |
root |
1.7 |
|
62 |
root |
1.1 |
#endif |
63 |
|
|
|