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

# User Rev Content
1 root 1.1 #ifndef VIEW_H
2     #define VIEW_H
3    
4     #include <set>
5 root 1.4 #include <map>
6 root 1.17 #include <utility>
7 root 1.1
8     using namespace std;
9    
10     #include "util.h"
11 root 1.17 #include "event.h"
12 root 1.1
13 root 1.12 struct visibility_state {
14     unsigned int generation;
15     enum { UNKNOWN, OCCLUDED, PARTIAL, FULL } visibility;
16 root 1.18 double last;
17 root 1.12
18 root 1.18 visibility_state () : generation(0), last(0.), visibility(UNKNOWN) { };
19 root 1.12 };
20    
21 root 1.17 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 root 1.2 struct view {
32     sector orig;
33     point p;
34     vec3 d, u;
35 root 1.13 GLfloat fov;
36     GLfloat near, far;
37 root 1.2 int w, h;
38    
39 root 1.13 GLfloat gamma;
40 root 1.4
41 root 1.17 // only to be used by friends: TODO
42 root 1.5
43 root 1.13 GLfloat nextfar;
44 root 1.17 GLfloat diagfact; // bounding box border to depth factor
45 root 1.13
46 root 1.8 matrix projection;
47 root 1.9
48 root 1.5 struct {
49     plane l, r, t, b, n, f;
50     } frustum;
51 root 1.14
52 root 1.13 enum mode { DEPTH, LIGHTED } mode;
53 root 1.1 light *l;
54 root 1.15 set<const entity *> drawn;
55 root 1.4
56     unsigned int generation;
57     map<octant *, visibility_state> vismap;
58 root 1.17
59 root 1.16 vector<octant *> vislist; // octants partially or fully visible in frustum
60 root 1.14 vector<octant *> farlist; // octants possibly visible
61 root 1.17
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 root 1.13
67     void reset_projection ();
68    
69     // public
70    
71     void begin ();
72     void pass (enum mode m);
73     void end ();
74 root 1.1
75 root 1.15 bool may_draw (const entity *e);
76 root 1.1
77 root 1.12 view ();
78     ~view ();
79 root 1.1 };
80 root 1.7
81 root 1.1 #endif
82