… | |
… | |
4 | |
4 | |
5 | #include "view.h" |
5 | #include "view.h" |
6 | #include "oct.h" |
6 | #include "oct.h" |
7 | #include "material.h" |
7 | #include "material.h" |
8 | |
8 | |
|
|
9 | #include "entity.h" |
|
|
10 | |
9 | using namespace gl; |
11 | using namespace gl; |
|
|
12 | |
|
|
13 | skybox *world_skybox; |
10 | |
14 | |
11 | pass_data pass_depth (0, DEPTH); |
15 | pass_data pass_depth (0, DEPTH); |
12 | pass_data pass_postdepth (0, POSTDEPTH); |
16 | pass_data pass_postdepth (0, POSTDEPTH); |
13 | |
17 | |
14 | vector<GLuint> occ_query_objects; |
18 | vector<GLuint> occ_query_objects; |
… | |
… | |
240 | this->pass = &pass; |
244 | this->pass = &pass; |
241 | |
245 | |
242 | switch (pass.type) |
246 | switch (pass.type) |
243 | { |
247 | { |
244 | case DEPTH: |
248 | case DEPTH: |
245 | glColorMask (1, 1, 1, 1); |
|
|
246 | glDepthMask (1); |
|
|
247 | glDisable (GL_BLEND); |
|
|
248 | |
|
|
249 | //glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); |
|
|
250 | glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); |
|
|
251 | |
|
|
252 | //glEnable (GL_STENCIL_TEST); // for depth-passes |
|
|
253 | //glStencilOp (GL_KEEP, GL_KEEP, GL_REPLACE); |
|
|
254 | //glStencilFunc (GL_LESS, 1, 255); |
|
|
255 | |
|
|
256 | //glEnable (GL_POLYGON_OFFSET_FILL); |
|
|
257 | //glPolygonOffset (0, 5); |
|
|
258 | glEnable (GL_CULL_FACE); |
249 | glEnable (GL_CULL_FACE); |
259 | glDisable (GL_MINMAX); |
250 | glDisable (GL_MINMAX); |
260 | glDepthRange (DEPTH_OFFSET, 1.); |
251 | glDepthRange (DEPTH_OFFSET, 1.); |
261 | glDepthFunc (GL_LESS); |
252 | glDepthFunc (GL_LESS); |
|
|
253 | glColorMask (1, 1, 1, 1); |
|
|
254 | glDisable (GL_BLEND); |
|
|
255 | glDepthMask (1); |
|
|
256 | |
|
|
257 | glClear (GL_DEPTH_BUFFER_BIT | (world_skybox ? 0 : GL_COLOR_BUFFER_BIT)); |
|
|
258 | |
|
|
259 | //glEnable (GL_STENCIL_TEST); // for depth-passes |
|
|
260 | //glStencilOp (GL_KEEP, GL_KEEP, GL_REPLACE); |
|
|
261 | //glStencilFunc (GL_LESS, 1, 255); |
|
|
262 | |
|
|
263 | //glEnable (GL_POLYGON_OFFSET_FILL); |
|
|
264 | //glPolygonOffset (0, 5); |
262 | glEnable (GL_DEPTH_TEST); |
265 | glEnable (GL_DEPTH_TEST); |
263 | glColorMask (0, 0, 0, 0); |
266 | glColorMask (0, 0, 0, 0); |
264 | |
267 | |
265 | world.detect_visibility (*this); |
268 | world.detect_visibility (*this); |
266 | |
269 | |
… | |
… | |
317 | glDepthRange (0., 1. - DEPTH_OFFSET); |
320 | glDepthRange (0., 1. - DEPTH_OFFSET); |
318 | glDepthFunc (GL_LESS); |
321 | glDepthFunc (GL_LESS); |
319 | glColorMask (1, 1, 1, 1); |
322 | glColorMask (1, 1, 1, 1); |
320 | glDepthMask (0); |
323 | glDepthMask (0); |
321 | |
324 | |
|
|
325 | if (world_skybox) |
|
|
326 | { |
|
|
327 | glDisable (GL_DEPTH_TEST); |
|
|
328 | world_skybox->draw (*this);// |
|
|
329 | glEnable (GL_DEPTH_TEST); |
|
|
330 | } |
|
|
331 | |
322 | for (vector<octant *>::iterator i = vislist.begin (); i != vislist.end (); ++i) |
332 | for (vector<octant *>::iterator i = vislist.begin (); i != vislist.end (); ++i) |
323 | (*i)->draw_lighted (*this); |
333 | (*i)->draw_lighted (*this); |
324 | |
334 | |
325 | first_lighted = false; |
335 | first_lighted = false; |
326 | |
336 | |