--- ray/src/rt/rcontrib.c 2012/06/27 15:32:58 2.14 +++ ray/src/rt/rcontrib.c 2012/11/15 19:41:03 2.18 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: rcontrib.c,v 2.14 2012/06/27 15:32:58 greg Exp $"; +static const char RCSid[] = "$Id: rcontrib.c,v 2.18 2012/11/15 19:41:03 greg Exp $"; #endif /* * Accumulate ray contributions for a set of materials @@ -255,8 +255,10 @@ eval_irrad(FVECT org, FVECT dir) thisray.rdir[2] = -dir[2]; thisray.rmax = 0.0; rayorigin(&thisray, PRIMARY, NULL, NULL); - thisray.rot = 1e-5; /* pretend we hit surface */ + /* pretend we hit surface */ + thisray.rt = thisray.rot = 1e-5; thisray.rod = 1.0; + VCOPY(thisray.ron, dir); VSUM(thisray.rop, org, dir, 1e-4); samplendx++; /* compute result */ (*ofun[Lamb.otype].funp)(&Lamb, &thisray); @@ -314,7 +316,7 @@ rcontrib() #endif while (getvec(orig) == 0 && getvec(direc) == 0) { d = normalize(direc); - if (nchild != -1 && (d == 0.0) & (accumulate != 1)) { + if (nchild != -1 && (d == 0.0) & (accumulate == 0)) { if (!ignore_warning_given++) error(WARNING, "dummy ray(s) ignored during accumulation\n"); @@ -324,9 +326,10 @@ rcontrib() lastray = lastdone = 0; ++lastray; if (d == 0.0) { /* zero ==> flush */ - if ((yres <= 0) | (xres <= 0)) - waitflush = 1; /* flush right after */ - account = 1; + if ((yres <= 0) | (xres <= 1)) + waitflush = 1; /* flush after */ + if (nchild == -1) + account = 1; } else if (imm_irrad) { /* else compute */ eval_irrad(orig, direc); } else {