ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libgender/view.h
Revision: 1.23
Committed: Sat Oct 16 14:48:48 2004 UTC (19 years, 7 months ago) by root
Content type: text/plain
Branch: MAIN
Changes since 1.22: +1 -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.22 struct visibility_base
14 root 1.20 {
15 root 1.22 unsigned int generation; // freshness check
16     };
17 root 1.12
18 root 1.22 struct visible {
19     visibility_base *get_visibility (view &ctx);
20     virtual visibility_base *new_visibility () = 0;
21     virtual void clear_visibility (visibility_base *vs) = 0;
22 root 1.12 };
23    
24 root 1.20 struct occ_query
25     {
26 root 1.17 struct view &v;
27 root 1.22 void *id;
28 root 1.17 GLuint r;
29    
30 root 1.22 occ_query (view &v, void *id, GLuint r) : v(v), id(id), r(r) { };
31 root 1.17 };
32    
33     typedef event_receiver<void, occ_query> recv_occ_query;
34    
35 root 1.20 struct view
36     {
37 root 1.2 sector orig;
38     point p;
39     vec3 d, u;
40 root 1.13 GLfloat fov;
41 root 1.19 GLfloat z_near, z_far, c_far;
42 root 1.2 int w, h;
43 root 1.21 GLfloat pixfact; // how many pixels on screen are drawn by a unit length line, *roughly*
44 root 1.2
45 root 1.13 GLfloat gamma;
46 root 1.4
47 root 1.17 // only to be used by friends: TODO
48 root 1.5
49 root 1.19 GLfloat nz_far, nc_far;
50 root 1.17 GLfloat diagfact; // bounding box border to depth factor
51 root 1.21 GLfloat perspfact; // perspfact * (1/depth)=> pixels
52 root 1.13
53 root 1.8 matrix projection;
54 root 1.9
55 root 1.5 struct {
56     plane l, r, t, b, n, f;
57     } frustum;
58 root 1.14
59 root 1.23 enum mode { DEPTH, POSTDEPTH, LIGHTED } mode;
60 root 1.20 struct light *l;
61 root 1.15 set<const entity *> drawn;
62 root 1.4
63     unsigned int generation;
64 root 1.22 typedef map<visible *, visibility_base *> visibility_map;
65     visibility_map vismap;
66 root 1.17
67 root 1.16 vector<octant *> vislist; // octants partially or fully visible in frustum
68 root 1.14 vector<octant *> farlist; // octants possibly visible
69 root 1.17
70 root 1.22 struct oq_data {
71     recv_occ_query *recv;
72     GLint id;
73     void *data;
74    
75     oq_data (recv_occ_query *recv, GLint id, void *data) : recv(recv), id(id), data(data) { };
76     };
77 root 1.17 vector<oq_data> occ_queries;
78 root 1.22 void begin_occ_query (recv_occ_query &recv, void *id = 0);
79 root 1.17 void end_occ_query ();
80 root 1.13
81     void reset_projection ();
82    
83     // public
84    
85     void begin ();
86     void pass (enum mode m);
87     void end ();
88 root 1.1
89 root 1.15 bool may_draw (const entity *e);
90 root 1.1
91 root 1.12 view ();
92     ~view ();
93 root 1.1 };
94 root 1.7
95 root 1.1 #endif
96