--- ray/src/rt/m_mirror.c 2015/02/24 19:39:26 2.17 +++ ray/src/rt/m_mirror.c 2020/01/21 21:31:58 2.22 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: m_mirror.c,v 2.17 2015/02/24 19:39:26 greg Exp $"; +static const char RCSid[] = "$Id: m_mirror.c,v 2.22 2020/01/21 21:31:58 greg Exp $"; #endif /* * Routines for mirror material supporting virtual light sources @@ -11,7 +11,6 @@ static const char RCSid[] = "$Id: m_mirror.c,v 2.17 20 #include "otypes.h" #include "rtotypes.h" #include "source.h" -#include "pmapmat.h" /* * The real arguments for MAT_MIRROR are simply: @@ -40,18 +39,14 @@ m_mirror( /* shade mirrored ray */ RAY nr; int rpure = 1; int i; - - /* PMAP: skip specular refl via ambient bounce if already accounted for - * in photon map */ - if (ambRayInPmap(r)) - return(1); /* check arguments */ if (m->oargs.nfargs != 3 || m->oargs.nsargs > 1) 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); @@ -103,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 += raydistance(&nr); return(1); }