--- ray/src/rt/virtuals.c 2004/03/30 16:13:01 2.14 +++ ray/src/rt/virtuals.c 2010/10/28 09:38:46 2.18 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: virtuals.c,v 2.14 2004/03/30 16:13:01 schorsch Exp $"; +static const char RCSid[] = "$Id: virtuals.c,v 2.18 2010/10/28 09:38:46 greg Exp $"; #endif /* * Routines for simulating virtual light sources @@ -309,7 +309,7 @@ vstestvis( /* pretest source visibility */ FVECT onorm; FVECT offsdir; SRCINDEX si; - double or, d; + double or, d, d1; int stestlim, ssn; int nhit, nok; register int i, n; @@ -360,8 +360,7 @@ vstestvis( /* pretest source visibility */ sr.rorg[i] = oc[i] + offsdir[i] + d*onorm[i]; sr.rdir[i] = -onorm[i]; } - sr.rmax = 0.0; - rayorigin(&sr, NULL, PRIMARY, 1.0); + rayorigin(&sr, PRIMARY, NULL, NULL); } while (!(*ofun[o->otype].funp)(o, &sr)); /* check against source */ VCOPY(sr.rorg, sr.rop); /* starting from intersection */ @@ -375,14 +374,21 @@ vstestvis( /* pretest source visibility */ } sr.revf = srcvalue; rayvalue(&sr); /* check sample validity */ - if (bright(sr.rcol) <= FTINY) + if ((d = bright(sr.rcol)) <= FTINY) continue; nok++; /* got sample; check obstructions */ rayclear(&sr); sr.revf = raytrace; rayvalue(&sr); - if (bright(sr.rcol) > FTINY) + if ((d1 = bright(sr.rcol)) > FTINY) { + if (d - d1 > FTINY) { +#ifdef DEBUG + fprintf(stderr, "\tpartially shadowed\n"); +#endif + return(f); /* intervening transmitter */ + } nhit++; + } if (nhit > 0 && nhit < nok) { #ifdef DEBUG fprintf(stderr, "\tpartially occluded\n");