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

Comparing libgender/view.C (file contents):
Revision 1.41 by root, Sat Oct 9 23:20:09 2004 UTC vs.
Revision 1.42 by root, Sun Oct 10 00:00:52 2004 UTC

68 return true; 68 return true;
69} 69}
70 70
71void view::reset_projection () 71void view::reset_projection ()
72{ 72{
73 //renormalize (orig, p); 73 renormalize (orig, p);
74 74
75 glViewport (0, 0, w, h); 75 glViewport (0, 0, w, h);
76 76
77 glMatrixMode (GL_PROJECTION); 77 glMatrixMode (GL_PROJECTION);
78 glLoadIdentity (); 78 glLoadIdentity ();
79 79
80 GLdouble aspect = (GLdouble)w/h; 80 GLdouble aspect = (GLdouble)w/h;
81 GLdouble ymax = near * tan (fov * (M_PI / 360.0)); 81 GLdouble ymax = z_near * tan (fov * (M_PI / 360.0));
82 82
83 glFrustum (-ymax * aspect, ymax * aspect, -ymax, ymax, near, far); 83 glFrustum (-ymax * aspect, ymax * aspect, -ymax, ymax, z_near, z_far);
84 84
85 d = normalize (d);//D 85 d = normalize (d);//D
86 u = normalize (u);//D 86 u = normalize (u);//D
87 87
88 vec3 rz = -d; 88 vec3 rz = -d;
135 i->first->event (oq); 135 i->first->event (oq);
136 } 136 }
137 137
138 occ_queries.clear (); 138 occ_queries.clear ();
139 139
140 nextfar = near + 1.F; 140 nc_far = nz_far = z_near + 1.F;
141 world.detect_visibility (*this); 141 world.detect_visibility (*this);
142 z_far = nz_far;
143 c_far = nc_far;
144 z_far = c_far;//D
145
142 printf ("far %f nf %f RCP %f,%f,%f +%f\n", far, nextfar, 146 printf ("far %f cf %f RCP %f,%f,%f +%f\n", z_far, c_far,
143 frustum.r.n.x, 147 frustum.r.n.x,
144 frustum.r.n.y, 148 frustum.r.n.y,
145 frustum.r.n.z, 149 frustum.r.n.z,
146 frustum.r.d 150 frustum.r.d
147 );//D 151 );//D
148 far = nextfar;
149
150 reset_projection ();
151} 152}
152 153
153void view::end () 154void view::end ()
154{ 155{
155 vislist.clear (); 156 vislist.clear ();
203 drawn.clear (); 204 drawn.clear ();
204 205
205 if (mode == view::DEPTH) 206 if (mode == view::DEPTH)
206 { 207 {
207 glEnable (GL_DEPTH_CLAMP_NV); 208 glEnable (GL_DEPTH_CLAMP_NV);
209 glDepthMask (0);
208 glDepthFunc (GL_LESS); 210 glDepthFunc (GL_LESS);
209 if (mode == view::LIGHTED) glDepthFunc (GL_LEQUAL); 211 if (mode == view::LIGHTED) glDepthFunc (GL_LEQUAL);
210 glDisable (GL_LIGHTING); 212 glDisable (GL_LIGHTING);
211 cgGLDisableProfile (vsh_profile); 213 cgGLDisableProfile (vsh_profile);
212 cgGLDisableProfile (fsh_profile); 214 cgGLDisableProfile (fsh_profile);
213 //glShadeModel (GL_FLAT);
214 215
215#if 0 216#if 0
216 static int count; count++; 217 static int count; count++;
217 if (farlist.size ()) 218 if (farlist.size ())
218 printf ("%d: size %d\n", count, farlist.size ()); 219 printf ("%d: size %d\n", count, farlist.size ());
224 if (mode == view::LIGHTED) glColor3f ((((long)*i >> 6) & 15) / 31. + 0.5,0,0); 225 if (mode == view::LIGHTED) glColor3f ((((long)*i >> 6) & 15) / 31. + 0.5,0,0);
225 (*i)->draw_bbox (*this); 226 (*i)->draw_bbox (*this);
226 if (mode == view::DEPTH) end_occ_query (); 227 if (mode == view::DEPTH) end_occ_query ();
227 } 228 }
228 229
229 glEnable (GL_DEPTH_TEST);
230 glDisable (GL_DEPTH_CLAMP_NV); 230 glDisable (GL_DEPTH_CLAMP_NV);
231 //glShadeModel (GL_SMOOTH); 231 glDepthMask (1);
232 } 232 }
233 233
234 glColorMask (1, 1, 1, 0); 234 glColorMask (1, 1, 1, 0);
235 glDepthMask (1); 235 glDepthMask (1);
236 236

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines