… | |
… | |
104 | { |
104 | { |
105 | vs = i->second; |
105 | vs = i->second; |
106 | |
106 | |
107 | if (vs->generation != ctx.generation) |
107 | if (vs->generation != ctx.generation) |
108 | { |
108 | { |
109 | if (vs->generation + 1 != ctx.generation) |
109 | if (ctx.generation - vs->generation > 2) |
110 | clear_visibility (vs); |
110 | clear_visibility (vs); |
111 | |
111 | |
112 | vs->generation = ctx.generation; |
112 | vs->generation = ctx.generation; |
113 | } |
113 | } |
114 | } |
114 | } |
… | |
… | |
203 | void view::begin () |
203 | void view::begin () |
204 | { |
204 | { |
205 | generation++; |
205 | generation++; |
206 | |
206 | |
207 | vislist.clear (); |
207 | vislist.clear (); |
|
|
208 | postdepthlist.clear (); |
208 | |
209 | |
209 | z_near = max (nz_near, 1.F); |
210 | z_near = max (nz_near, 1.F); |
210 | z_far = max (nz_far, z_near * 2.F); |
211 | z_far = max (nz_far, z_near * 2.F); |
211 | c_far = nc_far; |
212 | c_far = nc_far; |
212 | |
213 | |
… | |
… | |
251 | glDisable (GL_MINMAX); |
252 | glDisable (GL_MINMAX); |
252 | glDepthRange (DEPTH_OFFSET, 1.); |
253 | glDepthRange (DEPTH_OFFSET, 1.); |
253 | glDepthFunc (GL_LESS); |
254 | glDepthFunc (GL_LESS); |
254 | glEnable (GL_DEPTH_TEST); |
255 | glEnable (GL_DEPTH_TEST); |
255 | glColorMask (0, 0, 0, 0); |
256 | glColorMask (0, 0, 0, 0); |
256 | glDisable (GL_DEPTH_CLAMP_NV); |
|
|
257 | |
257 | |
258 | world.detect_visibility (*this); |
258 | world.detect_visibility (*this); |
259 | |
259 | |
260 | for (vector<octant *>::iterator i = vislist.begin (); i != vislist.end (); ++i) |
260 | for (vector<octant *>::iterator i = vislist.begin (); i != vislist.end (); ++i) |
261 | (*i)->draw_depth (*this); |
261 | (*i)->draw_depth (*this); |
… | |
… | |
269 | case POSTDEPTH: |
269 | case POSTDEPTH: |
270 | glDepthRange (0., 1. - DEPTH_OFFSET); |
270 | glDepthRange (0., 1. - DEPTH_OFFSET); |
271 | glDepthFunc (GL_LESS); |
271 | glDepthFunc (GL_LESS); |
272 | glColorMask (0, 0, 0, 0); |
272 | glColorMask (0, 0, 0, 0); |
273 | glDepthMask (0); |
273 | glDepthMask (0); |
274 | glEnable (GL_DEPTH_CLAMP_NV); |
|
|
275 | glDisable (GL_STENCIL_TEST); |
274 | glDisable (GL_STENCIL_TEST); |
276 | glDisable (GL_CULL_FACE); |
275 | glDisable (GL_CULL_FACE); |
277 | |
276 | |
278 | occ_query_material.enable (*this); |
277 | occ_query_material.enable (*this); |
279 | |
278 | |
… | |
… | |
286 | |
285 | |
287 | occ_query_material.disable (*this); |
286 | occ_query_material.disable (*this); |
288 | |
287 | |
289 | occ_queries.clear (); |
288 | occ_queries.clear (); |
290 | |
289 | |
291 | for (vector<octant *>::iterator i = vislist.begin (); i != vislist.end (); ++i) |
290 | for (vector<octant *>::iterator i = postdepthlist.begin (); i != postdepthlist.end (); ++i) |
292 | (*i)->draw_postdepth (*this); |
291 | (*i)->draw_postdepth (*this); |
293 | |
292 | |
294 | first_lighted = true; |
293 | first_lighted = true; |
295 | |
294 | |
296 | break; |
295 | break; |
… | |
… | |
310 | glEnable (GL_MINMAX); |
309 | glEnable (GL_MINMAX); |
311 | glDepthRange (0., 1. - DEPTH_OFFSET); |
310 | glDepthRange (0., 1. - DEPTH_OFFSET); |
312 | glDepthFunc (GL_LESS); |
311 | glDepthFunc (GL_LESS); |
313 | glColorMask (1, 1, 1, 1); |
312 | glColorMask (1, 1, 1, 1); |
314 | glDepthMask (0); |
313 | glDepthMask (0); |
315 | glDisable (GL_DEPTH_CLAMP_NV); |
|
|
316 | |
314 | |
317 | for (vector<octant *>::iterator i = vislist.begin (); i != vislist.end (); ++i) |
315 | for (vector<octant *>::iterator i = vislist.begin (); i != vislist.end (); ++i) |
318 | (*i)->draw_lighted (*this); |
316 | (*i)->draw_lighted (*this); |
319 | |
317 | |
320 | first_lighted = false; |
318 | first_lighted = false; |