--- ray/src/rt/source.c 1995/12/11 15:00:24 2.21 +++ ray/src/rt/source.c 1996/03/21 15:33:09 2.23 @@ -22,6 +22,10 @@ static char SCCSid[] = "$SunId$ LBL"; extern double ssampdist; /* scatter sampling distance */ +#ifndef MAXSSAMP +#define MAXSSAMP 16 /* maximum samples per ray */ +#endif + /* * Structures used by direct() */ @@ -333,8 +337,7 @@ char *p; /* data for f */ ( sr.ro != source[scp->sno].so || source[scp->sno].sflags & SFOLLOW )) { /* follow entire path */ - if (!raycont(&sr)) - objerror(sr.ro, USER, "material not found"); + raycont(&sr); rayparticipate(&sr); if (trace != NULL) (*trace)(&sr); /* trace execution */ @@ -382,10 +385,15 @@ register RAY *r; COLOR cumval, ctmp; int i, j; - if (r->slights == NULL || r->slights[0] == 0 || r->gecc >= 1.-FTINY) + if (r->slights == NULL || r->slights[0] == 0 + || r->gecc >= 1.-FTINY || r->rot >= FHUGE) return; if (ssampdist <= FTINY || (nsamps = r->rot/ssampdist + .5) < 1) nsamps = 1; +#if MAXSSAMP + else if (nsamps > MAXSSAMP) + nsamps = MAXSSAMP; +#endif oldsampndx = samplendx; samplendx = random()&0x7fff; /* randomize */ for (i = r->slights[0]; i > 0; i--) { /* for each source */