ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libgender/view.C
(Generate patch)

Comparing libgender/view.C (file contents):
Revision 1.18 by root, Wed Oct 6 01:41:30 2004 UTC vs.
Revision 1.26 by root, Wed Oct 6 15:20:11 2004 UTC

1#include <cmath> 1#include <cmath>
2
3#include <GL/gl.h>
4#include <GL/glext.h>
2 5
3#include "oct.h" 6#include "oct.h"
4#include "view.h" 7#include "view.h"
5 8
6view::view () 9view::view ()
66} 69}
67 70
68void view::begin () 71void view::begin ()
69{ 72{
70 vismap.clear (); 73 vismap.clear ();
74 vislist.clear ();
71 75
72 generation++; 76 generation++;
73 77
74 reset_projection (); 78 reset_projection ();
75 79
76 // check occlusion queries here 80 // check occlusion queries here
81#if 0
82 for (vector<octant *>::iterator i = checklist.begin (); i != checklist.end (); ++i)
83 //printf ("%p %d\n", *i, occ_query_result ((*i)->occ_query));
84 occ_query_result ((*i)->occ_query);
85
77 checklist.clear (); 86 checklist.clear ();
87#endif
78 88
79 world.detect_visibility (*this); 89 world.detect_visibility (*this);
80} 90}
81 91
82void view::end () 92void view::end ()
96 glEnable (GL_POLYGON_OFFSET_FILL); 106 glEnable (GL_POLYGON_OFFSET_FILL);
97 glPolygonOffset (0, 1); 107 glPolygonOffset (0, 1);
98 glDepthFunc (GL_LESS); 108 glDepthFunc (GL_LESS);
99 glDisable (GL_LIGHTING); 109 glDisable (GL_LIGHTING);
100 glColorMask (0, 0, 0, 0); 110 glColorMask (0, 0, 0, 0);
101 //cgGLDisableProfile (CG_PROFILE_ARBVP1); 111 cgGLEnableProfile (vsh_profile);// z-fighting??
102 cgGLDisableProfile (CG_PROFILE_ARBFP1); 112 cgGLDisableProfile (fsh_profile);
103 } 113 }
104 else 114 else
105 { 115 {
106 glEnable (GL_MINMAX); 116 glEnable (GL_MINMAX);
107 glDisable (GL_POLYGON_OFFSET_FILL); 117 glDisable (GL_POLYGON_OFFSET_FILL);
108 glDepthFunc (GL_LESS); 118 glDepthFunc (GL_LESS);
109 glDepthMask (0); 119 glDepthMask (0);
110 cgGLEnableProfile (CG_PROFILE_ARBVP1); 120 cgGLEnableProfile (vsh_profile);
111 cgGLEnableProfile (CG_PROFILE_ARBFP1); 121 cgGLEnableProfile (fsh_profile);
112 } 122 }
113 123
114 for (vector<octant *>::iterator i = vislist.begin (); i != vislist.end (); ++i) 124 for (vector<octant *>::iterator i = vislist.begin (); i != vislist.end (); ++i)
115 (*i)->display (*this); 125 (*i)->display (*this);
116 126
117 drawn.clear (); 127 drawn.clear ();
118 128
129 if (mode == view::DEPTH)
130 {
131 static int count; count++;
132 if (farlist.size ())
133 printf ("%d: size %d\n", count, farlist.size ());
134
135 glDepthFunc (GL_LEQUAL);
136 for (vector<octant *>::iterator i = farlist.begin (); i != farlist.end (); ++i)
137 (*i)->draw_bbox (*this);
138
139 farlist.clear ();
140 }
141
119 glColorMask (1, 1, 1, 0); 142 glColorMask (1, 1, 1, 0);
120 glDepthMask (1); 143 glDepthMask (1);
121} 144}
122 145
123 146

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines