--- ray/src/rt/source.c 2003/12/31 02:03:08 2.39 +++ ray/src/rt/source.c 2014/09/15 00:54:39 2.63 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: source.c,v 2.39 2003/12/31 02:03:08 greg Exp $"; +static const char RCSid[] = "$Id: source.c,v 2.63 2014/09/15 00:54:39 greg Exp $"; #endif /* * source.c - routines dealing with illumination sources. @@ -7,20 +7,12 @@ static const char RCSid[] = "$Id: source.c,v 2.39 2003 * External symbols declared in source.h */ -#include "copyright.h" - #include "ray.h" - #include "otypes.h" - -#include "otspecial.h" - +#include "rtotypes.h" #include "source.h" - #include "random.h" -extern double ssampdist; /* scatter sampling distance */ - #ifndef MAXSSAMP #define MAXSSAMP 16 /* maximum samples per ray */ #endif @@ -45,13 +37,13 @@ static CONTRIB *srccnt; /* source contributions in d static CNTPTR *cntord; /* source ordering in direct() */ static int maxcntr = 0; /* size of contribution arrays */ +static int cntcmp(const void *p1, const void *p2); + OBJREC * /* find an object's actual material */ -findmaterial(register OBJREC *o) +findmaterial(OBJREC *o) { while (!ismaterial(o->otype)) { - if (ismixture(o->otype)) - return(NULL); /* reject mixed materials */ if (o->otype == MOD_ALIAS && o->oargs.nsargs) { OBJECT aobj; OBJREC *ao; @@ -61,22 +53,26 @@ findmaterial(register OBJREC *o) ao = objptr(aobj); if (ismaterial(ao->otype)) return(ao); + if (ao->otype == MOD_ALIAS) { + o = ao; + continue; + } } if (o->omod == OVOID) return(NULL); o = objptr(o->omod); } - return(o); + return(o); /* mixtures will return NULL */ } void -marksources() /* find and mark source objects */ +marksources(void) /* find and mark source objects */ { int foundsource = 0; int i; - register OBJREC *o, *m; - register int ns; + OBJREC *o, *m; + int ns; /* initialize dispatch table */ initstypes(); /* find direct sources */ @@ -87,22 +83,29 @@ marksources() /* find and mark source objects */ if (!issurface(o->otype) || o->omod == OVOID) continue; /* find material */ - m = findmaterial(o); - if (m == NULL || !islight(m->otype)) + m = findmaterial(objptr(o->omod)); + if (m == NULL) + continue; + if (m->otype == MAT_CLIP) { + markclip(m); /* special case for antimatter */ + continue; + } + if (!islight(m->otype)) continue; /* not source modifier */ if (m->oargs.nfargs != (m->otype == MAT_GLOW ? 4 : m->otype == MAT_SPOT ? 7 : 3)) objerror(m, USER, "bad # arguments"); - if (m->otype == MAT_GLOW && - o->otype != OBJ_SOURCE && - m->oargs.farg[3] <= FTINY) - continue; /* don't bother */ if (m->oargs.farg[0] <= FTINY && m->oargs.farg[1] <= FTINY && m->oargs.farg[2] <= FTINY) continue; /* don't bother */ - + if (m->otype == MAT_GLOW && + o->otype != OBJ_SOURCE && + m->oargs.farg[3] <= FTINY) { + foundsource += (ambounce > 0); + continue; /* don't track these */ + } if (sfun[o->otype].of == NULL || sfun[o->otype].of->setsrc == NULL) objerror(o, USER, "illegal material"); @@ -115,8 +118,10 @@ marksources() /* find and mark source objects */ if (m->otype == MAT_GLOW) { source[ns].sflags |= SPROX; source[ns].sl.prox = m->oargs.farg[3]; - if (source[ns].sflags & SDISTANT) + if (source[ns].sflags & SDISTANT) { source[ns].sflags |= SSKIP; + foundsource += (ambounce > 0); + } } else if (m->otype == MAT_SPOT) { source[ns].sflags |= SSPOT; if ((source[ns].sl.s = makespot(m)) == NULL) @@ -129,10 +134,9 @@ marksources() /* find and mark source objects */ } } #if SHADCACHE - source[ns].obscache = NULL; + initobscache(ns); #endif - if (!(source[ns].sflags & SSKIP)) - foundsource++; + foundsource += !(source[ns].sflags & SSKIP); } if (!foundsource) { error(WARNING, "no light sources found"); @@ -152,7 +156,7 @@ memerr: void -freesources() /* free all source structures */ +freesources(void) /* free all source structures */ { if (nsources > 0) { #if SHADCACHE @@ -163,6 +167,7 @@ freesources() /* free all source structures */ source = NULL; nsources = 0; } + markclip(NULL); if (maxcntr <= 0) return; free((void *)srccnt); @@ -175,49 +180,52 @@ freesources() /* free all source structures */ int srcray( /* send a ray to a source, return domega */ -register RAY *sr, /* returned source ray */ -RAY *r, /* ray which hit object */ -SRCINDEX *si /* source sample index */ + RAY *sr, /* returned source ray */ + RAY *r, /* ray which hit object */ + SRCINDEX *si /* source sample index */ ) { - double d; /* distance to source */ - register SRCREC *srcp; + double d; /* distance to source */ + SRCREC *srcp; - rayorigin(sr, r, SHADOW, 1.0); /* ignore limits */ + rayorigin(sr, SHADOW, r, NULL); /* ignore limits */ - while ((d = nextssamp(sr, si)) != 0.0) { - sr->rsrc = si->sn; /* remember source */ - srcp = source + si->sn; - if (srcp->sflags & SDISTANT) { - if (srcp->sflags & SSPOT && spotout(sr, srcp->sl.s)) - continue; - return(1); /* sample OK */ - } + if (r == NULL) + sr->rmax = 0.0; + + while ((d = nextssamp(sr, si)) != 0.0) { + sr->rsrc = si->sn; /* remember source */ + srcp = source + si->sn; + if (srcp->sflags & SDISTANT) { + if (srcp->sflags & SSPOT && spotout(sr, srcp->sl.s)) + continue; + return(1); /* sample OK */ + } /* local source */ /* check proximity */ - if (srcp->sflags & SPROX && d > srcp->sl.prox) - continue; - /* check angle */ - if (srcp->sflags & SSPOT) { - if (spotout(sr, srcp->sl.s)) + if (srcp->sflags & SPROX && d > srcp->sl.prox) continue; + /* check angle */ + if (srcp->sflags & SSPOT) { + if (spotout(sr, srcp->sl.s)) + continue; /* adjust solid angle */ - si->dom *= d*d; - d += srcp->sl.s->flen; - si->dom /= d*d; + si->dom *= d*d; + d += srcp->sl.s->flen; + si->dom /= d*d; + } + return(1); /* sample OK */ } - return(1); /* sample OK */ - } - return(0); /* no more samples */ + return(0); /* no more samples */ } void srcvalue( /* punch ray to source and compute value */ -register RAY *r + RAY *r ) { - register SRCREC *sp; + SRCREC *sp; sp = &source[r->rsrc]; if (sp->sflags & SVIRTUAL) { /* virtual source */ @@ -254,243 +262,99 @@ nomat: } +static int +transillum( /* check if material is transparent illum */ + OBJECT obj +) +{ + OBJREC *m = findmaterial(objptr(obj)); + + if (m == NULL) + return(1); + if (m->otype != MAT_ILLUM) + return(0); + return(!m->oargs.nsargs || !strcmp(m->oargs.sarg[0], VOIDID)); +} + + int sourcehit( /* check to see if ray hit distant source */ -register RAY *r + RAY *r ) { + int glowsrc = -1; + int transrc = -1; int first, last; - register int i; + int i; if (r->rsrc >= 0) { /* check only one if aimed */ first = last = r->rsrc; } else { /* otherwise check all */ first = 0; last = nsources-1; } - for (i = first; i <= last; i++) - if ((source[i].sflags & (SDISTANT|SVIRTUAL)) == SDISTANT) - /* - * Check to see if ray is within - * solid angle of source. - */ - if (2.0*PI * (1.0 - DOT(source[i].sloc,r->rdir)) - <= source[i].ss2) { - r->ro = source[i].so; - if (!(source[i].sflags & SSKIP)) - break; - } - - if (r->ro != NULL) { - r->robj = objndx(r->ro); - for (i = 0; i < 3; i++) - r->ron[i] = -r->rdir[i]; - r->rod = 1.0; - r->pert[0] = r->pert[1] = r->pert[2] = 0.0; - r->uv[0] = r->uv[1] = 0.0; - r->rox = NULL; - return(1); + for (i = first; i <= last; i++) { + if ((source[i].sflags & (SDISTANT|SVIRTUAL)) != SDISTANT) + continue; + /* + * Check to see if ray is within + * solid angle of source. + */ + if (2.*PI*(1. - DOT(source[i].sloc,r->rdir)) > source[i].ss2) + continue; + /* is it the only possibility? */ + if (first == last) { + r->ro = source[i].so; + break; + } + /* + * If it's a glow or transparent illum, just remember it. + */ + if (source[i].sflags & SSKIP) { + if (glowsrc < 0) + glowsrc = i; + continue; + } + if (transillum(source[i].so->omod)) { + if (transrc < 0) + transrc = i; + continue; + } + r->ro = source[i].so; /* otherwise, use first hit */ + break; } - return(0); -} - - -#if SHADCACHE /* preemptive shadow checking */ -#define ABS(x) ((x)>0 ? (x) : -(x)) - -static void /* find closest blockers to source */ -initobscache(SRCREC *srcp) -{ - int i; - int cachelen; - - if (srcp->sflags & SDISTANT) - cachelen = 4*SHADCACHE*SHADCACHE; - else if (srcp->sflags & SFLAT) - cachelen = SHADCACHE*SHADCACHE*3 + (SHADCACHE&1)*SHADCACHE*4; - else /* spherical distribution */ - cachelen = SHADCACHE*SHADCACHE*6; - /* allocate cache */ - DCHECK(srcp->obscache != NULL, - CONSISTENCY, "initobscache() called twice"); - srcp->obscache = (OBSCACHE *)malloc(sizeof(OBSCACHE) + - sizeof(OBJECT)*(cachelen-1)); - if (srcp->obscache == NULL) - error(SYSTEM, "out of memory in initobscache()"); - /* set parameters */ - if (srcp->sflags & SDISTANT) { - int ax, ax1, ax2; - RREAL amax = 0; - for (ax1 = 3; ax1--; ) - if (ABS(srcp->sloc[ax1]) > amax) { - amax = ABS(srcp->sloc[ax1]); - ax = ax1; - } - srcp->obscache->p.d.ax = ax; - ax1 = (ax+1)%3; - ax2 = (ax+2)%3; - VCOPY(srcp->obscache->p.d.o, thescene.cuorg); - if (srcp->sloc[ax] > 0) - srcp->obscache->p.d.o[ax] += thescene.cusize; - if (srcp->sloc[ax1] < 0) - srcp->obscache->p.d.o[ax1] += thescene.cusize * - srcp->sloc[ax1] / ABS(srcp->sloc[ax]); - if (srcp->sloc[ax2] < 0) - srcp->obscache->p.d.o[ax2] += thescene.cusize * - srcp->sloc[ax2] / ABS(srcp->sloc[ax]); - srcp->obscache->p.d.e1 = (1.-FTINY) / (thescene.cusize*(1. + - fabs(srcp->sloc[ax1]/srcp->sloc[ax]))); - srcp->obscache->p.d.e2 = (1.-FTINY) / (thescene.cusize*(1. + - fabs(srcp->sloc[ax2]/srcp->sloc[ax]))); - } else if (srcp->sflags & SFLAT) { - VCOPY(srcp->obscache->p.f.u, srcp->ss[SU]); - normalize(srcp->obscache->p.f.u); - fcross(srcp->obscache->p.f.v, - srcp->snorm, srcp->obscache->p.f.u); + /* + * Do we need fallback? + */ + if (r->ro == NULL) { + if (transrc >= 0 && r->crtype & (AMBIENT|SPECULAR)) + return(0); /* avoid overcounting */ + if (glowsrc >= 0) + r->ro = source[glowsrc].so; + else + return(0); /* nothing usable */ } - /* XXX Should cast rays from source */ - for (i = cachelen; i--; ) - srcp->obscache->obs[i] = OVOID; + /* + * Make assignments. + */ + r->robj = objndx(r->ro); + for (i = 0; i < 3; i++) + r->ron[i] = -r->rdir[i]; + r->rod = 1.0; + r->pert[0] = r->pert[1] = r->pert[2] = 0.0; + r->uv[0] = r->uv[1] = 0.0; + r->rox = NULL; + return(1); } -static OBJECT * /* return occluder cache entry */ -srcobstructp(register RAY *r) -{ - static OBJECT noobs; - SRCREC *srcp; - int ondx; - - DCHECK(r->rsrc < 0, CONSISTENCY, - "srcobstructp() called with unaimed ray"); - noobs = OVOID; - srcp = &source[r->rsrc]; - if (srcp->obscache == NULL) /* initialize cache */ - initobscache(srcp); - /* compute cache index */ - if (srcp->sflags & SDISTANT) { - int ax, ax1, ax2; - double t; - ax = srcp->obscache->p.d.ax; - if ((ax1 = ax+1) >= 3) ax1 -= 3; - if ((ax2 = ax+2) >= 3) ax2 -= 3; - t = (srcp->obscache->p.d.o[ax] - r->rorg[ax]) / srcp->sloc[ax]; - if (t <= FTINY) - return &noobs; /* could happen if ray is outside */ - ondx = 2*SHADCACHE*(int)(2*SHADCACHE*srcp->obscache->p.d.e1 * - (r->rorg[ax1] + t*srcp->sloc[ax1] - - srcp->obscache->p.d.o[ax1])); - ondx += (int)(2*SHADCACHE*srcp->obscache->p.d.e2 * - (r->rorg[ax2] + t*srcp->sloc[ax2] - - srcp->obscache->p.d.o[ax2])); - if (ondx < 0 | ondx >= 4*SHADCACHE*SHADCACHE) - return &nobs; /* could happen if ray is outside */ - } else if (srcp->sflags & SFLAT) { - FVECT sd; - RREAL sd0m, sd1m; - sd[0] = -DOT(r->rdir, srcp->obscache->p.f.u); - sd[1] = -DOT(r->rdir, srcp->obscache->p.f.v); - sd[2] = -DOT(r->rdir, srcp->snorm); - if (sd[2] < 0) - return &noobs; /* shouldn't happen */ - sd0m = ABS(sd[0]); - sd1m = ABS(sd[1]); - if (sd[2] >= sd0m && sd[2] >= sd1m) { - ondx = SHADCACHE*(int)(SHADCACHE*(.5-FTINY) * - (1. + sd[0]/sd[2])); - ondx += (int)(SHADCACHE*(.5-FTINY) * - (1. + sd[1]/sd[2])); - } else if (sd0m >= sd1m) { - ondx = SHADCACHE*SHADCACHE; - if (sd[0] < 0) - ondx += ((SHADCACHE+1)>>1)*SHADCACHE; - ondx += SHADCACHE*(int)(SHADCACHE*(.5-FTINY) * - sd[2]/sd0m); - ondx += (int)(SHADCACHE*(.5-FTINY) * - (1. + sd[1]/sd0m)); - } else /* sd1m > sd0m */ { - ondx = SHADCACHE*SHADCACHE + - ((SHADCACHE+1)>>1)*SHADCACHE*2; - if (sd[1] < 0) - ondx += ((SHADCACHE+1)>>1)*SHADCACHE; - ondx += SHADCACHE*(int)(SHADCACHE*(.5-FTINY) * - sd[2]/sd1m); - ondx += (int)(SHADCACHE*(.5-FTINY) * - (1. + sd[0]/sd1m)); - } - } else /* spherical distribution */ { - int ax, ax1, ax2; - RREAL amax = 0; - for (ax1 = 3; ax1--; ) - if (ABS(r->rdir[ax1]) > amax) { - amax = ABS(r->rdir[ax1]); - ax = ax1; - } - if ((ax1 = ax+1) >= 3) ax1 -= 3; - if ((ax2 = ax+2) >= 3) ax2 -= 3; - ondx = 2*SHADCACHE*SHADCACHE * ax; - if (r->rdir[ax] < 0) - ondx += SHADCACHE*SHADCACHE; - ondx += SHADCACHE*(int)(SHADCACHE*(.5-FTINY) * - (1. + r->rdir[ax1]/amax)); - ondx += (int)(SHADCACHE*(.5-FTINY) * - (1. + r->rdir[ax2]/amax)); - } - /* return cache pointer */ - return(&srcp->obscache->obs[ondx]); -} - - -void /* free obstruction cache */ -freeobscache(SRCREC *srcp) -{ - if (srcp->obscache == NULL) - return; - free((void *)srcp->obscache); - srcp->obscache = NULL; -} - - -void /* record a source blocker */ -srcblocker(register RAY *r) -{ - OBJREC *m; - - if (r->robj == OVOID || objptr(r->robj) != r->ro || - isvolume(r->ro->otype)) - return; /* don't record complex blockers */ - m = findmaterial(r->ro); - if (m == NULL) - return; /* no material?! */ - if (!(ofun[m->otype].flags & T_OPAQUE)) - return; /* material not a reliable blocker */ - - *srcobstructp(r) = r->robj; /* else record obstructor */ -} - - -int /* check ray against cached blocker */ -srcblocked(RAY *r) -{ - OBJECT obs = *srcobstructp(r); - OBJREC *op; - - if (obs == OVOID) - return(0); - op = objptr(obs); /* check for intersection */ - return ((*ofun[op->otype].funp)(op, r)); -} - -#endif - - static int cntcmp( /* contribution compare (descending) */ -const void *p1, -const void *p2 + const void *p1, + const void *p2 ) { - register const CNTPTR *sc1 = (const CNTPTR *)p1; - register const CNTPTR *sc2 = (const CNTPTR *)p2; + const CNTPTR *sc1 = (const CNTPTR *)p1; + const CNTPTR *sc2 = (const CNTPTR *)p2; if (sc1->brt > sc2->brt) return(-1); @@ -502,14 +366,13 @@ const void *p2 void direct( /* add direct component */ -RAY *r, /* ray that hit surface */ -void (*f)(), /* direct component coefficient function */ -char *p /* data for f */ + RAY *r, /* ray that hit surface */ + srcdirf_t *f, /* direct component coefficient function */ + void *p /* data for f */ ) { - extern void (*trace)(); - register int sn; - register CONTRIB *scp; + int sn; + CONTRIB *scp; SRCINDEX si; int nshadcheck, ncnts; int nhits; @@ -535,7 +398,7 @@ char *p /* data for f */ scp->sno = sr.rsrc; /* compute coefficient */ (*f)(scp->coef, p, sr.rdir, si.dom); - cntord[sn].brt = bright(scp->coef); + cntord[sn].brt = intens(scp->coef); if (cntord[sn].brt <= 0.0) continue; #if SHADCACHE @@ -546,17 +409,18 @@ char *p /* data for f */ } #endif VCOPY(scp->dir, sr.rdir); + copycolor(sr.rcoef, scp->coef); /* compute potential */ sr.revf = srcvalue; rayvalue(&sr); + multcolor(sr.rcol, sr.rcoef); copycolor(scp->val, sr.rcol); - multcolor(scp->val, scp->coef); - cntord[sn].brt = bright(scp->val); + cntord[sn].brt = bright(sr.rcol); } /* sort contributions */ qsort(cntord, sn, sizeof(CNTPTR), cntcmp); { /* find last */ - register int l, m; + int l, m; ncnts = l = sn; sn = 0; @@ -576,7 +440,10 @@ char *p /* data for f */ /* compute number to check */ nshadcheck = pow((double)ncnts, shadcert) + .5; /* modify threshold */ - ourthresh = shadthresh / r->rweight; + if (ncnts > MINSHADCNT) + ourthresh = shadthresh / r->rweight; + else + ourthresh = 0; /* test for shadows */ for (nhits = 0, hwt = 0.0, sn = 0; sn < ncnts; hwt += (double)source[scp->sno].nhits / @@ -589,7 +456,8 @@ char *p /* data for f */ break; scp = srccnt + cntord[sn].sndx; /* test for hit */ - rayorigin(&sr, r, SHADOW, 1.0); + rayorigin(&sr, SHADOW, r, NULL); + copycolor(sr.rcoef, scp->coef); VCOPY(sr.rdir, scp->dir); sr.rsrc = scp->sno; /* keep statistics */ @@ -602,20 +470,26 @@ char *p /* data for f */ source[scp->sno].sflags & SFOLLOW )) { /* follow entire path */ raycont(&sr); - rayparticipate(&sr); if (trace != NULL) (*trace)(&sr); /* trace execution */ if (bright(sr.rcol) <= FTINY) { #if SHADCACHE if ((scp <= srccnt || scp[-1].sno != scp->sno) - && (scp >= srccnt+ncnts || + && (scp >= srccnt+ncnts-1 || scp[1].sno != scp->sno)) srcblocker(&sr); #endif continue; /* missed! */ } + rayparticipate(&sr); + multcolor(sr.rcol, sr.rcoef); copycolor(scp->val, sr.rcol); - multcolor(scp->val, scp->coef); + } else if (trace != NULL && + (source[scp->sno].sflags & (SDISTANT|SVIRTUAL|SFOLLOW)) + == (SDISTANT|SFOLLOW) && + sourcehit(&sr) && rayshade(&sr, sr.ro->omod)) { + (*trace)(&sr); /* trace execution */ + /* skip call to rayparticipate() & scp->val update */ } /* add contribution if hit */ addcolor(r->rcol, scp->val); @@ -637,9 +511,8 @@ char *p /* data for f */ scp = srccnt + cntord[sn].sndx; prob = hwt * (double)source[scp->sno].nhits / (double)source[scp->sno].ntests; - if (prob > 1.0) - prob = 1.0; - scalecolor(scp->val, prob); + if (prob < 1.0) + scalecolor(scp->val, prob); addcolor(r->rcol, scp->val); } } @@ -647,7 +520,7 @@ char *p /* data for f */ void srcscatter( /* compute source scattering into ray */ -register RAY *r + RAY *r ) { int oldsampndx; @@ -686,20 +559,27 @@ register RAY *r sr.rorg[0] = r->rorg[0] + r->rdir[0]*t; sr.rorg[1] = r->rorg[1] + r->rdir[1]*t; sr.rorg[2] = r->rorg[2] + r->rdir[2]*t; - sr.rmax = 0.; initsrcindex(&si); /* sample ray to this source */ si.sn = r->slights[i]; nopart(&si, &sr); if (!srcray(&sr, NULL, &si) || sr.rsrc != r->slights[i]) continue; /* no path */ +#if SHADCACHE + if (srcblocked(&sr)) /* check shadow cache */ + continue; +#endif copycolor(sr.cext, r->cext); copycolor(sr.albedo, r->albedo); sr.gecc = r->gecc; sr.slights = r->slights; rayvalue(&sr); /* eval. source ray */ - if (bright(sr.rcol) <= FTINY) + if (bright(sr.rcol) <= FTINY) { +#if SHADCACHE + srcblocker(&sr); /* add blocker to cache */ +#endif continue; + } if (r->gecc <= FTINY) /* compute P(theta) */ d = 1.; else { @@ -737,13 +617,12 @@ register RAY *r */ static int -weaksrcmat(int obj) /* identify material */ +weaksrcmat(OBJECT obj) /* identify material */ { - register OBJREC *o = objptr(obj); + OBJREC *m = findmaterial(objptr(obj)); - while (!ismaterial(o->otype)) /* find material */ - o = objptr(o->omod); - return((o->otype==MAT_ILLUM)|(o->otype==MAT_GLOW)); + if (m == NULL) return(0); + return((m->otype==MAT_ILLUM) | (m->otype==MAT_GLOW)); } #define illumblock(m, r) (!(source[r->rsrc].sflags&SVIRTUAL) && \ @@ -806,15 +685,19 @@ weaksrcmat(int obj) /* identify material */ int m_light( /* ray hit a light source */ -register OBJREC *m, -register RAY *r + OBJREC *m, + RAY *r ) { /* check for over-counting */ - if (badcomponent(m, r)) + if (badcomponent(m, r)) { + setcolor(r->rcoef, 0.0, 0.0, 0.0); return(1); - if (wrongsource(m, r)) + } + if (wrongsource(m, r)) { + setcolor(r->rcoef, 0.0, 0.0, 0.0); return(1); + } /* check for passed illum */ if (passillum(m, r)) { if (m->oargs.nsargs && strcmp(m->oargs.sarg[0], VOIDID)) @@ -822,12 +705,14 @@ register RAY *r raytrans(r); return(1); } + /* check for invisibility */ + if (srcignore(m, r)) { + setcolor(r->rcoef, 0.0, 0.0, 0.0); + return(1); + } /* otherwise treat as source */ /* check for behind */ if (r->rod < 0.0) - return(1); - /* check for invisibility */ - if (srcignore(m, r)) return(1); /* check for outside spot */ if (m->otype==MAT_SPOT && spotout(r, makespot(m)))