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.73 by greg, Tue Nov 13 19:58:33 2018 UTC vs.
Revision 2.78 by greg, Sat May 4 23:10:32 2019 UTC

# Line 118 | Line 118 | rtrace(                                /* trace rays from file */
118          unsigned long  vcount = (hresolu > 1) ? (unsigned long)hresolu*vresolu
119                                                : (unsigned long)vresolu;
120          long  nextflush = (vresolu > 0) & (hresolu > 1) ? 0 : hresolu;
121 +        int  bogusflushed = 0;
122          FILE  *fp;
123          double  d;
124          FVECT  orig, direc;
# Line 154 | Line 155 | rtrace(                                /* trace rays from file */
155          if (hresolu > 0) {
156                  if (vresolu > 0)
157                          fprtresolu(hresolu, vresolu, stdout);
158 <                fflush(stdout);
158 >                else
159 >                        fflush(stdout);
160          }
161                                          /* process file */
162          while (getvec(orig, inform, fp) == 0 &&
# Line 162 | Line 164 | rtrace(                                /* trace rays from file */
164  
165                  d = normalize(direc);
166                  if (d == 0.0) {                         /* zero ==> flush */
167 <                        if (--nextflush <= 0 || !vcount) {
168 <                                if (nproc > 1 && ray_fifo_flush() < 0)
167 >                        if ((--nextflush <= 0) | !vcount && !bogusflushed) {
168 >                                if (ray_pnprocs > 1 && ray_fifo_flush() < 0)
169                                          error(USER, "child(ren) died");
170                                  bogusray();
171                                  fflush(stdout);
172 +                                bogusflushed = 1;
173                                  nextflush = (vresolu > 0) & (hresolu > 1) ? 0 :
174                                                                  hresolu;
175                          } else
# Line 175 | Line 178 | rtrace(                                /* trace rays from file */
178                          rtcompute(orig, direc, lim_dist ? d : 0.0);
179                                                          /* flush if time */
180                          if (!--nextflush) {
181 <                                if (nproc > 1 && ray_fifo_flush() < 0)
181 >                                if (ray_pnprocs > 1 && ray_fifo_flush() < 0)
182                                          error(USER, "child(ren) died");
183                                  fflush(stdout);
184                                  nextflush = hresolu;
185 <                        }
185 >                        } else
186 >                                bogusflushed = 0;
187                  }
188                  if (ferror(stdout))
189                          error(SYSTEM, "write error");
190                  if (vcount && !--vcount)                /* check for end */
191                          break;
192          }
193 <        if (nproc > 1) {                                /* clean up children */
193 >        if (ray_pnprocs > 1) {                          /* clean up children */
194                  if (ray_fifo_flush() < 0)
195                          error(USER, "unable to complete processing");
196                  ray_pclose(0);
# Line 314 | Line 318 | setoutput(                             /* set up output tables */
318   static void
319   bogusray(void)                  /* print out empty record */
320   {
317        thisray.rorg[0] = thisray.rorg[1] = thisray.rorg[2] =
318        thisray.rdir[0] = thisray.rdir[1] = thisray.rdir[2] = 0.0;
319        thisray.rmax = 0.0;
321          rayorigin(&thisray, PRIMARY, NULL, NULL);
322          printvals(&thisray);
323   }
# Line 343 | Line 344 | rayirrad(                      /* compute irradiance rather than radiance
344   )
345   {
346          void    (*old_revf)(RAY *) = r->revf;
347 <
348 <        r->rot = 1e-5;                  /* pretend we hit surface */
347 >                                        /* pretend we hit surface */
348 >        r->rxt = r->rot = 1e-5;
349          VSUM(r->rop, r->rorg, r->rdir, r->rot);
350          r->ron[0] = -r->rdir[0];
351          r->ron[1] = -r->rdir[1];

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines