--- ray/src/rt/source.c 2005/05/31 18:01:09 2.52 +++ ray/src/rt/source.c 2008/07/17 18:26:01 2.57 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: source.c,v 2.52 2005/05/31 18:01:09 greg Exp $"; +static const char RCSid[] = "$Id: source.c,v 2.57 2008/07/17 18:26:01 greg Exp $"; #endif /* * source.c - routines dealing with illumination sources. @@ -55,6 +55,10 @@ 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); @@ -82,7 +86,13 @@ marksources(void) /* find and mark source objects */ continue; /* find material */ m = findmaterial(objptr(o->omod)); - if (m == NULL || !islight(m->otype)) + 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 : @@ -382,7 +392,7 @@ direct( /* add direct component */ 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 @@ -399,7 +409,7 @@ direct( /* add direct component */ rayvalue(&sr); multcolor(sr.rcol, sr.rcoef); copycolor(scp->val, sr.rcol); - cntord[sn].brt = bright(scp->val); + cntord[sn].brt = bright(sr.rcol); } /* sort contributions */ qsort(cntord, sn, sizeof(CNTPTR), cntcmp); @@ -453,7 +463,6 @@ direct( /* add direct component */ raycont(&sr); if (trace != NULL) (*trace)(&sr); /* trace execution */ - rayparticipate(&sr); if (bright(sr.rcol) <= FTINY) { #if SHADCACHE if ((scp <= srccnt || scp[-1].sno != scp->sno) @@ -463,6 +472,7 @@ direct( /* add direct component */ #endif continue; /* missed! */ } + rayparticipate(&sr); multcolor(sr.rcol, sr.rcoef); copycolor(scp->val, sr.rcol); } else if (trace != NULL &&