--- ray/src/rt/source.c 1991/06/20 16:36:41 1.36 +++ ray/src/rt/source.c 1991/07/11 16:39:03 1.39 @@ -75,7 +75,7 @@ marksources() /* find and mark source objects */ if ((ns = newsource()) < 0) goto memerr; - (*sfun[o->otype].of->setsrc)(&source[ns], o); + setsource(&source[ns], o); if (m->otype == MAT_GLOW) { source[ns].sflags |= SPROX; @@ -86,6 +86,12 @@ marksources() /* find and mark source objects */ source[ns].sflags |= SSPOT; if ((source[ns].sl.s = makespot(m)) == NULL) goto memerr; + if (source[ns].sflags & SFLAT && + !checkspot(source[ns].sl.s,source[ns].snorm)) { + objerror(o, WARNING, + "invalid spotlight direction"); + source[ns].sflags |= SSKIP; + } } } if (nsources <= 0) { @@ -146,7 +152,7 @@ register int sn; /* source number */ for (i = 0; i < 3; i++) { dimlist[ndims] = i + 8831; vd[i] = dstrsrc * source[sn].ss * - (1.0 - 2.0*urand(ilhash(dimlist,ndims+1)+samplendx)); + (1.0 - 2.0*urand(urind(ilhash(dimlist,ndims+1),samplendx))); } ndims--; if (source[sn].sflags & SFLAT) { /* project offset */