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