--- ray/src/rt/dielectric.c 2013/08/07 05:10:09 2.23 +++ ray/src/rt/dielectric.c 2014/05/10 17:43:01 2.24 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: dielectric.c,v 2.23 2013/08/07 05:10:09 greg Exp $"; +static const char RCSid[] = "$Id: dielectric.c,v 2.24 2014/05/10 17:43:01 greg Exp $"; #endif /* * dielectric.c - shading function for transparent materials. @@ -64,10 +64,10 @@ mylog( /* special log for extinction coefficients */ } -extern int +int m_dielectric( /* color a ray which hit a dielectric interface */ OBJREC *m, - register RAY *r + RAY *r ) { double cos1, cos2, nratio; @@ -81,7 +81,7 @@ m_dielectric( /* color a ray which hit a dielectric in FVECT dnorm; double d1, d2; RAY p; - register int i; + int i; if (m->oargs.nfargs != (m->otype==MAT_DIELECTRIC ? 5 : 8)) objerror(m, USER, "bad arguments"); @@ -94,7 +94,8 @@ m_dielectric( /* color a ray which hit a dielectric in VCOPY(dnorm, r->ron); cos1 = r->rod; } - flatsurface = !hastexture && r->ro != NULL && isflat(r->ro->otype); + flatsurface = r->ro != NULL && isflat(r->ro->otype) && + !hastexture | (r->crtype & AMBIENT); /* index of refraction */ if (m->otype == MAT_DIELECTRIC) @@ -199,8 +200,8 @@ m_dielectric( /* color a ray which hit a dielectric in addcolor(r->rcol, p.rcol); /* virtual distance */ if (flatsurface || - (1.-FTINY <= nratio && - nratio <= 1.+FTINY)) { + (1.-FTINY <= nratio) & + (nratio <= 1.+FTINY)) { transtest = 2*bright(p.rcol); transdist = r->rot + p.rt; } @@ -380,7 +381,7 @@ disperse( /* check light sources for dispersion */ static int lambda( /* compute lambda for material */ - register OBJREC *m, + OBJREC *m, FVECT v2, FVECT dv, FVECT lr