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

Comparing libgender/oct.C (file contents):
Revision 1.65 by root, Sat Oct 23 02:27:51 2004 UTC vs.
Revision 1.67 by root, Thu Oct 28 22:29:29 2004 UTC

137 if (fd < -(ctx.c_far - ctx.z_far) -rad * 3.F) 137 if (fd < -(ctx.c_far - ctx.z_far) -rad * 3.F)
138 return false; 138 return false;
139#endif 139#endif
140 } 140 }
141 141
142#if 1
142 if (vs.state == OCCLUDED) 143 if (vs.state == OCCLUDED)
143 { 144 {
144 if (size ()) 145 if (size ())
145 ctx.vislist.push_back (this); 146 ctx.vislist.push_back (this);
146 return false; 147 //return false;
147 } 148 }
149#endif
148 150
149 GLfloat z = ctx.z_near + distance (ctx.frustum.n, centerf) + rad; 151 GLfloat z = ctx.z_near + distance (ctx.frustum.n, centerf) + rad;
150 if (ctx.perspfact * extent / z < 1.) // very crude "too small to see" check 152 if (ctx.perspfact * extent / z < 1.) // very crude "too small to see" check
151 return false; 153 return false;
152 //printf ("z %f, perspfact %f, z*p %f\n", z, ctx.perspfact, ctx.perspfact / z); 154 //printf ("z %f, perspfact %f, z*p %f\n", z, ctx.perspfact, ctx.perspfact / z);
176 sub[si]->detect_visibility (ctx); 178 sub[si]->detect_visibility (ctx);
177 } 179 }
178 while (*++next); 180 while (*++next);
179 181
180 if (size () 182 if (size ()
181 && (vs.state == PARTIAL || vs.state == FULL)) 183 && (vs.state == PARTIAL || vs.state == FULL || vs.state == OCCLUDED))
182 ctx.vislist.push_back (this); 184 ctx.vislist.push_back (this);
183 185
184 return true; 186 return true;
185} 187}
186 188
217 if (ctx.pass == view::POSTDEPTH) 219 if (ctx.pass == view::POSTDEPTH)
218 { 220 {
219 ctx.begin_occ_query (*this, 0); 221 ctx.begin_occ_query (*this, 0);
220 sector s = orig - ctx.orig; 222 sector s = orig - ctx.orig;
221 gl::draw_bbox (s, s + extent); 223 gl::draw_bbox (s, s + extent);
222 printf ("bbox %Ld,%ld,%Ld\n", s.x, s.y, s.z);
223 ctx.end_occ_query (); 224 ctx.end_occ_query ();
224 } 225 }
225 } 226 }
226 else 227 else
227 { 228 {
228 int nvis = 0; 229 int nvis = 0;
229 230
230 for (iterator i = begin (); i != end (); ) 231 for (iterator i = begin (); i != end (); )
231 { 232 {
232 entity *e = *i++; 233 entity *e = *i++;
233
234 if (!ctx.may_draw (e))
235 continue;
236 234
237 evis &evs = vs.vismap[e]; 235 evis &evs = vs.vismap[e];
238 236
239 if (ctx.pass == view::POSTDEPTH) 237 if (ctx.pass == view::POSTDEPTH)
240 { 238 {
247 else 245 else
248 nvis++; 246 nvis++;
249 } 247 }
250 else 248 else
251 { 249 {
250 if (!ctx.may_draw (e))
251 continue;
252
253
252 if (evs.state != OCCLUDED) 254 if (evs.state != OCCLUDED)
253 { 255 {
254 sector center = ((e->a + e->b) >> 1) - ctx.orig; 256 sector center = ((e->a + e->b) >> 1) - ctx.orig;
255 GLfloat z = length (vec3 (center)); 257 GLfloat z = length (vec3 (center));
256 ctx.pixfact = ctx.perspfact / z; 258 ctx.pixfact = ctx.perspfact / z;
269 } 271 }
270 } 272 }
271 } 273 }
272 } 274 }
273 275
274#if 0 276#if 1
275 if (ctx.pass == view::POSTDEPTH && nvis == 0 && size ()) 277 if (ctx.pass == view::POSTDEPTH && nvis == 0 && size ())
276 vs.state = OCCLUDED; 278 vs.state = OCCLUDED;
277#endif 279#endif
278 } 280 }
279} 281}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines