--- ray/src/rt/rtrace.c 2009/12/14 04:49:16 2.61 +++ ray/src/rt/rtrace.c 2009/12/16 03:30:50 2.63 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: rtrace.c,v 2.61 2009/12/14 04:49:16 greg Exp $"; +static const char RCSid[] = "$Id: rtrace.c,v 2.63 2009/12/16 03:30:50 greg Exp $"; #endif /* * rtrace.c - program and variables for individual ray tracing. @@ -160,13 +160,14 @@ rtrace( /* trace rays from file */ d = normalize(direc); if (d == 0.0) { /* zero ==> flush */ - if (nproc > 1 && ray_fifo_flush() < 0) - error(USER, "lost children"); - bogusray(); if (--nextflush <= 0 || !vcount) { + if (nproc > 1 && ray_fifo_flush() < 0) + error(USER, "lost children"); + bogusray(); fflush(stdout); nextflush = hresolu; - } + } else + bogusray(); } else { /* compute and print */ rtcompute(orig, direc, lim_dist ? d : 0.0); /* flush if time */ @@ -320,15 +321,18 @@ rayirrad( /* compute irradiance rather than radiance RAY *r ) { + void (*old_revf)(RAY *) = r->revf; + r->rot = 1e-5; /* pretend we hit surface */ VSUM(r->rop, r->rorg, r->rdir, r->rot); r->ron[0] = -r->rdir[0]; r->ron[1] = -r->rdir[1]; r->ron[2] = -r->rdir[2]; r->rod = 1.0; - r->revf = raytrace; /* compute result */ + r->revf = raytrace; (*ofun[Lamb.otype].funp)(&Lamb, r); + r->revf = old_revf; }