--- ray/src/rt/source.c 2005/05/26 06:55:22 2.51 +++ ray/src/rt/source.c 2006/09/07 05:20:54 2.55 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: source.c,v 2.51 2005/05/26 06:55:22 greg Exp $"; +static const char RCSid[] = "$Id: source.c,v 2.55 2006/09/07 05:20:54 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); @@ -382,7 +386,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 +403,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 = intens(sr.rcol); } /* sort contributions */ qsort(cntord, sn, sizeof(CNTPTR), cntcmp); @@ -437,7 +441,8 @@ direct( /* add direct component */ break; scp = srccnt + cntord[sn].sndx; /* test for hit */ - rayorigin(&sr, SHADOW, r, scp->coef); + rayorigin(&sr, SHADOW, r, NULL); + copycolor(sr.rcoef, scp->coef); VCOPY(sr.rdir, scp->dir); sr.rsrc = scp->sno; /* keep statistics */ @@ -452,7 +457,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) @@ -462,6 +466,7 @@ direct( /* add direct component */ #endif continue; /* missed! */ } + rayparticipate(&sr); multcolor(sr.rcol, sr.rcoef); copycolor(scp->val, sr.rcol); } else if (trace != NULL &&