| 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.5 |
struct { |
| 35 |
|
|
plane l, r, t, b, n, f; |
| 36 |
|
|
} frustum; |
| 37 |
root |
1.14 |
|
| 38 |
root |
1.13 |
enum mode { DEPTH, LIGHTED } mode; |
| 39 |
root |
1.1 |
light *l; |
| 40 |
|
|
set<entity_base *> drawn; |
| 41 |
root |
1.4 |
|
| 42 |
|
|
unsigned int generation; |
| 43 |
|
|
map<octant *, visibility_state> vismap; |
| 44 |
root |
1.6 |
vector<octant *> vislist; // octants partially or fully visible |
| 45 |
root |
1.14 |
vector<octant *> farlist; // octants possibly visible |
| 46 |
root |
1.13 |
|
| 47 |
|
|
void reset_projection (); |
| 48 |
|
|
|
| 49 |
|
|
// public |
| 50 |
|
|
|
| 51 |
|
|
void begin (); |
| 52 |
|
|
void pass (enum mode m); |
| 53 |
|
|
void end (); |
| 54 |
root |
1.1 |
|
| 55 |
|
|
bool may_draw (entity_base *e); |
| 56 |
|
|
|
| 57 |
root |
1.12 |
view (); |
| 58 |
|
|
~view (); |
| 59 |
root |
1.1 |
}; |
| 60 |
root |
1.7 |
|
| 61 |
root |
1.1 |
#endif |
| 62 |
|
|
|