ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libgender/view.h
Revision: 1.21
Committed: Mon Oct 11 00:05:48 2004 UTC (19 years, 8 months ago) by root
Content type: text/plain
Branch: MAIN
Changes since 1.20: +2 -0 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 root 1.21 GLfloat pixfact; // how many pixels on screen are drawn by a unit length line, *roughly*
42 root 1.2
43 root 1.13 GLfloat gamma;
44 root 1.4
45 root 1.17 // only to be used by friends: TODO
46 root 1.5
47 root 1.19 GLfloat nz_far, nc_far;
48 root 1.17 GLfloat diagfact; // bounding box border to depth factor
49 root 1.21 GLfloat perspfact; // perspfact * (1/depth)=> pixels
50 root 1.13
51 root 1.8 matrix projection;
52 root 1.9
53 root 1.5 struct {
54     plane l, r, t, b, n, f;
55     } frustum;
56 root 1.14
57 root 1.13 enum mode { DEPTH, LIGHTED } mode;
58 root 1.20 struct light *l;
59 root 1.15 set<const entity *> drawn;
60 root 1.4
61     unsigned int generation;
62     map<octant *, visibility_state> vismap;
63 root 1.17
64 root 1.16 vector<octant *> vislist; // octants partially or fully visible in frustum
65 root 1.14 vector<octant *> farlist; // octants possibly visible
66 root 1.17
67     typedef pair<recv_occ_query *, GLint> oq_data;
68     vector<oq_data> occ_queries;
69     void begin_occ_query (recv_occ_query &recv);
70     void end_occ_query ();
71 root 1.13
72     void reset_projection ();
73    
74     // public
75    
76     void begin ();
77     void pass (enum mode m);
78     void end ();
79 root 1.1
80 root 1.15 bool may_draw (const entity *e);
81 root 1.1
82 root 1.12 view ();
83     ~view ();
84 root 1.1 };
85 root 1.7
86 root 1.1 #endif
87