ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/libgender/view.h
Revision: 1.20
Committed: Sun Oct 10 14:15:16 2004 UTC (22 years ago) by root
Content type: text/plain
Branch: MAIN
Changes since 1.19: +7 -4 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.20 struct visibility_state
14     {
15 root 1.12 unsigned int generation;
16     enum { UNKNOWN, OCCLUDED, PARTIAL, FULL } visibility;
17 root 1.18 double last;
18 root 1.12
19 root 1.18 visibility_state () : generation(0), last(0.), visibility(UNKNOWN) { };
20 root 1.12 };
21    
22 root 1.20 struct occ_query
23     {
24 root 1.17 struct view &v;
25     GLuint id;
26     GLuint r;
27    
28     occ_query (view &v, GLuint id, GLuint r) : v(v), id(id), r(r) { };
29     };
30    
31     typedef event_receiver<void, occ_query> recv_occ_query;
32    
33 root 1.20 struct view
34     {
35 root 1.2 sector orig;
36     point p;
37     vec3 d, u;
38 root 1.13 GLfloat fov;
39 root 1.19 GLfloat z_near, z_far, c_far;
40 root 1.2 int w, h;
41    
42 root 1.13 GLfloat gamma;
43 root 1.4
44 root 1.17 // only to be used by friends: TODO
45 root 1.5
46 root 1.19 GLfloat nz_far, nc_far;
47 root 1.17 GLfloat diagfact; // bounding box border to depth factor
48 root 1.13
49 root 1.8 matrix projection;
50 root 1.9
51 root 1.5 struct {
52     plane l, r, t, b, n, f;
53     } frustum;
54 root 1.14
55 root 1.13 enum mode { DEPTH, LIGHTED } mode;
56 root 1.20 struct light *l;
57 root 1.15 set<const entity *> drawn;
58 root 1.4
59     unsigned int generation;
60     map<octant *, visibility_state> vismap;
61 root 1.17
62 root 1.16 vector<octant *> vislist; // octants partially or fully visible in frustum
63 root 1.14 vector<octant *> farlist; // octants possibly visible
64 root 1.17
65     typedef pair<recv_occ_query *, GLint> oq_data;
66     vector<oq_data> occ_queries;
67     void begin_occ_query (recv_occ_query &recv);
68     void end_occ_query ();
69 root 1.13
70     void reset_projection ();
71    
72     // public
73    
74     void begin ();
75     void pass (enum mode m);
76     void end ();
77 root 1.1
78 root 1.15 bool may_draw (const entity *e);
79 root 1.1
80 root 1.12 view ();
81     ~view ();
82 root 1.1 };
83 root 1.7
84 root 1.1 #endif
85