ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libgender/view.h
Revision: 1.18
Committed: Sat Oct 9 22:43:31 2004 UTC (19 years, 8 months ago) by root
Content type: text/plain
Branch: MAIN
Changes since 1.17: +2 -1 lines
Log Message:
*** empty log message ***

File Contents

# Content
1 #ifndef VIEW_H
2 #define VIEW_H
3
4 #include <set>
5 #include <map>
6 #include <utility>
7
8 using namespace std;
9
10 #include "util.h"
11 #include "event.h"
12
13 struct visibility_state {
14 unsigned int generation;
15 enum { UNKNOWN, OCCLUDED, PARTIAL, FULL } visibility;
16 double last;
17
18 visibility_state () : generation(0), last(0.), visibility(UNKNOWN) { };
19 };
20
21 struct occ_query {
22 struct view &v;
23 GLuint id;
24 GLuint r;
25
26 occ_query (view &v, GLuint id, GLuint r) : v(v), id(id), r(r) { };
27 };
28
29 typedef event_receiver<void, occ_query> recv_occ_query;
30
31 struct view {
32 sector orig;
33 point p;
34 vec3 d, u;
35 GLfloat fov;
36 GLfloat near, far;
37 int w, h;
38
39 GLfloat gamma;
40
41 // only to be used by friends: TODO
42
43 GLfloat nextfar;
44 GLfloat diagfact; // bounding box border to depth factor
45
46 matrix projection;
47
48 struct {
49 plane l, r, t, b, n, f;
50 } frustum;
51
52 enum mode { DEPTH, LIGHTED } mode;
53 light *l;
54 set<const entity *> drawn;
55
56 unsigned int generation;
57 map<octant *, visibility_state> vismap;
58
59 vector<octant *> vislist; // octants partially or fully visible in frustum
60 vector<octant *> farlist; // octants possibly visible
61
62 typedef pair<recv_occ_query *, GLint> oq_data;
63 vector<oq_data> occ_queries;
64 void begin_occ_query (recv_occ_query &recv);
65 void end_occ_query ();
66
67 void reset_projection ();
68
69 // public
70
71 void begin ();
72 void pass (enum mode m);
73 void end ();
74
75 bool may_draw (const entity *e);
76
77 view ();
78 ~view ();
79 };
80
81 #endif
82