--- ray/src/rt/srcobstr.c 2004/09/10 16:05:07 2.9 +++ ray/src/rt/srcobstr.c 2005/04/19 01:15:07 2.12 @@ -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.12 2005/04/19 01:15:07 greg Exp $"; #endif /* * Source occlusion caching routines @@ -27,7 +27,7 @@ castshadow(int sn, FVECT rorg, FVECT rdir) VCOPY(rt.rorg, rorg); VCOPY(rt.rdir, rdir); rt.rmax = 0; - rayorigin(&rt, NULL, PRIMARY, 1.0); + rayorigin(&rt, PRIMARY, NULL, NULL); /* check for intersection */ while (localhit(&rt, &thescene)) { RAY rt1 = rt; /* pretend we were aimed at source */ @@ -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 */ }