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

Comparing libgender/view.C (file contents):
Revision 1.32 by root, Wed Oct 6 17:55:40 2004 UTC vs.
Revision 1.36 by root, Sat Oct 9 02:08:29 2004 UTC

14 14
15view::~view () 15view::~view ()
16{ 16{
17} 17}
18 18
19bool view::may_draw (entity_base *e) 19bool view::may_draw (const entity *e)
20{ 20{
21 if (drawn.find (e) != drawn.end ()) 21 if (drawn.find (e) != drawn.end ())
22 return false; 22 return false;
23 23
24 drawn.insert (e); 24 drawn.insert (e);
34 glMatrixMode (GL_PROJECTION); 34 glMatrixMode (GL_PROJECTION);
35 glLoadIdentity (); 35 glLoadIdentity ();
36 36
37 gl_error = glGetError (); 37 gl_error = glGetError ();
38 GLdouble aspect = (GLdouble)w/h; 38 GLdouble aspect = (GLdouble)w/h;
39 GLdouble zNear = 0.1; 39 GLdouble zNear = 1.;
40 GLdouble zFar = 50.; 40 GLdouble zFar = 500.;
41 41
42 gl_error = glGetError (); 42 gl_error = glGetError ();
43 GLdouble ymax = zNear * tan (fov * (M_PI / 360.0)); 43 GLdouble ymax = zNear * tan (fov * (M_PI / 360.0));
44 glFrustum (-ymax * aspect, ymax * aspect, -ymax, ymax, zNear, zFar); 44 glFrustum (-ymax * aspect, ymax * aspect, -ymax, ymax, zNear, zFar);
45 45
90 90
91 reset_projection (); 91 reset_projection ();
92 92
93 for (vector<octant *>::iterator i = farlist.begin (); i != farlist.end (); ++i) 93 for (vector<octant *>::iterator i = farlist.begin (); i != farlist.end (); ++i)
94 ; 94 ;
95
95 farlist.clear (); 96 farlist.clear ();
96 97
97 // check occlusion queries here 98 // check occlusion queries here
98#if 0 99#if 0
99 for (vector<octant *>::iterator i = checklist.begin (); i != checklist.end (); ++i) 100 for (vector<octant *>::iterator i = checklist.begin (); i != checklist.end (); ++i)
141 for (vector<octant *>::iterator i = vislist.begin (); i != vislist.end (); ++i) 142 for (vector<octant *>::iterator i = vislist.begin (); i != vislist.end (); ++i)
142 (*i)->display (*this); 143 (*i)->display (*this);
143 144
144 drawn.clear (); 145 drawn.clear ();
145 146
146 if (mode == view::LIGHTED) 147 if (mode == view::DEPTH || 1)
147 { 148 {
148 glEnable (GL_DEPTH_CLAMP_NV); 149 glEnable (GL_DEPTH_CLAMP_NV);
149 glDepthFunc (GL_LESS); 150 glDepthFunc (GL_LESS);
151 if (1) glDepthFunc (GL_LEQUAL);
150 glEnable (GL_COLOR_MATERIAL); 152 glEnable (GL_COLOR_MATERIAL);
151 glDisable (GL_LIGHTING); 153 glDisable (GL_LIGHTING);
152#if 1
153 cgGLDisableProfile (vsh_profile); 154 cgGLDisableProfile (vsh_profile);
154 cgGLDisableProfile (fsh_profile); 155 cgGLDisableProfile (fsh_profile);
155#endif
156 glShadeModel (GL_FLAT); 156 glShadeModel (GL_FLAT);
157 157
158#if 0
158 static int count; count++; 159 static int count; count++;
159 if (farlist.size ()) 160 if (farlist.size ())
160 printf ("%d: size %d\n", count, farlist.size ()); 161 printf ("%d: size %d\n", count, farlist.size ());
162#endif
161 163
162 for (vector<octant *>::iterator i = farlist.begin (); i != farlist.end (); ++i) 164 for (vector<octant *>::iterator i = farlist.begin (); i != farlist.end (); ++i)
163 { 165 {
164 glColor3f (1 / (GLfloat)(i - farlist.begin()), 1, 1 / (GLfloat)(i - farlist.begin())); 166 glColor3f (1,0,0);
165 (*i)->draw_bbox (*this); 167 (*i)->draw_bbox (*this);
166 } 168 }
167 169
168 glEnable (GL_DEPTH_TEST); 170 glEnable (GL_DEPTH_TEST);
169 glDisable (GL_DEPTH_CLAMP_NV); 171 glDisable (GL_DEPTH_CLAMP_NV);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines