--- ray/src/rt/m_mirror.c 2014/05/10 17:43:01 2.16 +++ ray/src/rt/m_mirror.c 2019/04/19 19:01:32 2.21 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: m_mirror.c,v 2.16 2014/05/10 17:43:01 greg Exp $"; +static const char RCSid[] = "$Id: m_mirror.c,v 2.21 2019/04/19 19:01:32 greg Exp $"; #endif /* * Routines for mirror material supporting virtual light sources @@ -44,8 +44,9 @@ m_mirror( /* shade mirrored ray */ objerror(m, USER, "bad number of arguments"); /* check for substitute material */ /* but avoid double-counting */ - if (m->oargs.nsargs > 0 && !(r->crtype & (AMBIENT|SPECULAR)) && - (r->rsrc < 0 || source[r->rsrc].so != r->ro)) { + if ( m->oargs.nsargs > 0 && + (r->rsrc < 0 || source[r->rsrc].so != r->ro) && + !(r->crtype & (AMBIENT|SPECULAR) && r->rod > 0.) ) { if (!strcmp(m->oargs.sarg[0], VOIDID)) { raytrans(r); return(1); @@ -97,9 +98,11 @@ m_mirror( /* shade mirrored ray */ checknorm(nr.rdir); rayvalue(&nr); multcolor(nr.rcol, nr.rcoef); + copycolor(r->mcol, nr.rcol); addcolor(r->rcol, nr.rcol); + r->rmt = r->rot; if (rpure && r->ro != NULL && isflat(r->ro->otype)) - r->rt = r->rot + nr.rt; + r->rmt += r->rot + raydistance(&nr); return(1); }