--- ray/src/rt/source.c 2003/07/27 22:12:03 2.35 +++ ray/src/rt/source.c 2003/09/12 22:35:54 2.37 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: source.c,v 2.35 2003/07/27 22:12:03 schorsch Exp $"; +static const char RCSid[] = "$Id: source.c,v 2.37 2003/09/12 22:35:54 greg Exp $"; #endif /* * source.c - routines dealing with illumination sources. @@ -60,11 +60,16 @@ marksources() /* find and mark source objects */ if (!issurface(o->otype) || o->omod == OVOID) continue; - + /* find material */ m = objptr(o->omod); - - if (!islight(m->otype)) - continue; + while (!ismaterial(m->otype)) + if (ismixture(m->otype) || m->omod == OVOID) { + m = NULL; + break; + } else + m = objptr(m->omod); + if (m == NULL || !islight(m->otype)) + continue; /* not source modifier */ if (m->oargs.nfargs != (m->otype == MAT_GLOW ? 4 : m->otype == MAT_SPOT ? 7 : 3)) @@ -491,13 +496,19 @@ register RAY *r; * geometry behind (or inside) an effective radiator. */ -static int weaksrcmod(obj) int obj; /* efficiency booster function */ -{register OBJREC *o = objptr(obj); -return((o->otype==MAT_ILLUM)|(o->otype==MAT_GLOW));} +static int +weaksrcmat(int obj) /* identify material */ +{ + register OBJREC *o = objptr(obj); + + while (!ismaterial(o->otype)) /* find material */ + o = objptr(o->omod); + return((o->otype==MAT_ILLUM)|(o->otype==MAT_GLOW)); +} #define illumblock(m, r) (!(source[r->rsrc].sflags&SVIRTUAL) && \ r->rod > 0.0 && \ - weaksrcmod(source[r->rsrc].so->omod)) + weaksrcmat(source[r->rsrc].so->omod)) /* wrongsource * *