--- ray/src/rt/srcobstr.c 2004/09/10 16:05:07 2.9 +++ ray/src/rt/srcobstr.c 2004/10/25 17:07:35 2.11 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: srcobstr.c,v 2.9 2004/09/10 16:05:07 greg Exp $"; +static const char RCSid[] = "$Id: srcobstr.c,v 2.11 2004/10/25 17:07:35 greg Exp $"; #endif /* * Source occlusion caching routines @@ -290,6 +290,8 @@ srcblocker(register RAY *r) if (r->robj == OVOID || objptr(r->robj) != r->ro || isvolume(r->ro->otype)) return(0); /* don't record complex blockers */ + if (r->rsrc < 0 || source[r->rsrc].so == r->ro) + return(0); /* just a mistake, that's all */ m = findmaterial(r->ro); if (m == NULL) return(0); /* no material?! */ @@ -308,15 +310,16 @@ srcblocked(RAY *r) if (obs == OVOID) return(0); - op = objptr(obs); /* check for intersection */ + op = objptr(obs); /* check blocker intersection */ if (!(*ofun[op->otype].funp)(op, r)) return(0); - op = source[r->rsrc].so; /* check source really obstructed */ - if ((*ofun[op->otype].funp)(op, r)) { - rayclear(r); /* actually, source in front! */ - return(0); - } - return(1); /* source truly blocked */ + if (source[r->rsrc].sflags & SDISTANT) + return(1); + op = source[r->rsrc].so; /* check source intersection */ + if (!(*ofun[op->otype].funp)(op, r)) + return(1); + rayclear(r); + return(0); /* source in front */ }