… | |
… | |
30 | occ_query (view &ctx, void *id, GLuint count) : ctx(ctx), id(id), count(count) { }; |
30 | occ_query (view &ctx, void *id, GLuint count) : ctx(ctx), id(id), count(count) { }; |
31 | }; |
31 | }; |
32 | |
32 | |
33 | typedef event_receiver<void, occ_query> recv_occ_query; |
33 | typedef event_receiver<void, occ_query> recv_occ_query; |
34 | |
34 | |
|
|
35 | struct pass |
|
|
36 | { |
|
|
37 | struct light *l; |
|
|
38 | |
|
|
39 | pass (light *l) : l(l) { } |
|
|
40 | }; |
|
|
41 | |
|
|
42 | extern pass pass_depth; |
|
|
43 | |
35 | struct view |
44 | struct view |
36 | { |
45 | { |
37 | sector orig; |
46 | sector orig; |
38 | point p; |
47 | point p; |
39 | vec3 d, u; |
48 | vec3 d, u; |
40 | GLfloat fov; |
49 | GLfloat fov; |
41 | GLfloat z_near, z_far, c_far; |
50 | GLfloat z_near, z_far, c_far; |
42 | int w, h; |
51 | int w, h; |
43 | GLfloat pixfact; // how many pixels on screen are drawn by a unit length line, *roughly* |
52 | GLfloat pixfact; // how many pixels on screen are drawn by a unit length line, *roughly* |
|
|
53 | sector eorig; // orig of currently-rendered entity in relation to the camera |
44 | |
54 | |
45 | GLfloat gamma; |
55 | GLfloat gamma; |
46 | |
56 | |
47 | // only to be used by friends: TODO |
57 | // only to be used by friends: TODO |
48 | |
58 | |
49 | GLfloat nz_far, nc_far; |
59 | GLfloat nz_far, nz_near, nc_far; |
50 | GLfloat diagfact; // bounding box border to depth factor |
60 | GLfloat diagfact; // bounding box border to depth factor |
51 | GLfloat perspfact; // perspfact * (1/depth)=> pixels |
61 | GLfloat perspfact; // perspfact * (1/depth)=> pixels |
52 | |
62 | |
53 | gl::matrix projection; |
63 | gl::matrix projection; |
54 | |
64 | |
55 | struct { |
65 | struct { |
56 | plane l, r, t, b, n, f; |
66 | plane l, r, t, b, n, f; |
|
|
67 | cone c; |
|
|
68 | sphere s; |
57 | } frustum; |
69 | } frustum; |
58 | |
70 | |
59 | // the passes |
71 | // the passes |
60 | enum pass { |
72 | enum pass_type { |
61 | DEPTH, // mandatory, render depth only |
73 | DEPTH, // mandatory, render depth only |
62 | POSTDEPTH, // mandatory, occ tests or ignored |
74 | POSTDEPTH, // mandatory, occ tests or ignored |
63 | LIGHTED, // optional, render faces in full glory |
75 | LIGHTED, // optional, render faces in full glory |
64 | } pass; |
76 | } pass_type; |
65 | |
77 | |
66 | struct light *l; |
78 | pass *pass_data; |
|
|
79 | |
67 | set<const entity *> drawn; // TODO: put drawn info and octant+entity visibility info into vismap! |
80 | set<const entity *> drawn; // TODO: put drawn info and octant+entity visibility info into vismap! |
68 | |
81 | |
69 | unsigned int generation; |
82 | unsigned int generation; |
70 | typedef map<visible *, visibility_base *> visibility_map; |
83 | typedef map<visible *, visibility_base *> visibility_map; |
71 | visibility_map vismap; |
84 | visibility_map vismap; |
… | |
… | |
86 | void reset_projection (); |
99 | void reset_projection (); |
87 | |
100 | |
88 | // public |
101 | // public |
89 | |
102 | |
90 | void begin (); |
103 | void begin (); |
91 | void render (enum pass p); |
104 | void render (enum pass_type p, pass &data); |
92 | void end (); |
105 | void end (); |
93 | |
106 | |
94 | bool may_draw (const entity *e); |
107 | bool may_draw (const entity *e); |
95 | |
108 | |
96 | view (); |
109 | view (); |
97 | ~view (); |
110 | ~view (); |
98 | }; |
111 | }; |
99 | |
112 | |
|
|
113 | struct light : view |
|
|
114 | { |
|
|
115 | colour c; |
|
|
116 | GLfloat intensity; |
|
|
117 | GLfloat radius; |
|
|
118 | }; |
|
|
119 | |
100 | #endif |
120 | #endif |
101 | |
121 | |