ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/rtrace.c
(Generate patch)

Comparing ray/src/rt/rtrace.c (file contents):
Revision 2.59 by greg, Sun Dec 13 19:13:04 2009 UTC vs.
Revision 2.63 by greg, Wed Dec 16 03:30:50 2009 UTC

# Line 160 | Line 160 | rtrace(                                /* trace rays from file */
160  
161                  d = normalize(direc);
162                  if (d == 0.0) {                         /* zero ==> flush */
163                        if (nproc > 1 && ray_fifo_flush() < 0)
164                                error(USER, "lost children");
165                        bogusray();
163                          if (--nextflush <= 0 || !vcount) {
164 +                                if (nproc > 1 && ray_fifo_flush() < 0)
165 +                                        error(USER, "lost children");
166 +                                bogusray();
167                                  fflush(stdout);
168                                  nextflush = hresolu;
169 <                        }
169 >                        } else
170 >                                bogusray();
171                  } else {                                /* compute and print */
172                          rtcompute(orig, direc, lim_dist ? d : 0.0);
173                                                          /* flush if time */
# Line 320 | Line 321 | rayirrad(                      /* compute irradiance rather than radiance
321          RAY *r
322   )
323   {
324 +        void    (*old_revf)(RAY *) = r->revf;
325 +
326          r->rot = 1e-5;                  /* pretend we hit surface */
327          VSUM(r->rop, r->rorg, r->rdir, r->rot);
328          r->ron[0] = -r->rdir[0];
# Line 327 | Line 330 | rayirrad(                      /* compute irradiance rather than radiance
330          r->ron[2] = -r->rdir[2];
331          r->rod = 1.0;
332                                          /* compute result */
333 +        r->revf = raytrace;
334          (*ofun[Lamb.otype].funp)(&Lamb, r);
335 +        r->revf = old_revf;
336   }
337  
338  
# Line 338 | Line 343 | rtcompute(                     /* compute and print ray value(s) */
343          double  dmax
344   )
345   {
346 <        if (imm_irrad) {                /* set up ray */
346 >                                        /* set up ray */
347 >        rayorigin(&thisray, PRIMARY, NULL, NULL);
348 >        if (imm_irrad) {
349                  VSUM(thisray.rorg, org, dir, 1.1e-4);
350                  thisray.rdir[0] = -dir[0];
351                  thisray.rdir[1] = -dir[1];
352                  thisray.rdir[2] = -dir[2];
353                  thisray.rmax = 0.0;
354 +                thisray.revf = rayirrad;
355          } else {
356                  VCOPY(thisray.rorg, org);
357                  VCOPY(thisray.rdir, dir);
358                  thisray.rmax = dmax;
359 +                if (castonly)
360 +                        thisray.revf = raycast;
361          }
352        rayorigin(&thisray, PRIMARY, NULL, NULL);
353                                        /* special case evaluators */
354        if (castonly)
355                thisray.revf = raycast;
356        else if (imm_irrad)
357                thisray.revf = rayirrad;
358
362          if (ray_pnprocs > 1) {          /* multiprocessing FIFO? */
363                  if (ray_fifo_in(&thisray) < 0)
364                          error(USER, "lost children");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines