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.66 by greg, Sat Jun 9 07:16:47 2012 UTC vs.
Revision 2.71 by greg, Tue Feb 13 20:27:19 2018 UTC

# Line 162 | Line 162 | rtrace(                                /* trace rays from file */
162                  if (d == 0.0) {                         /* zero ==> flush */
163                          if (--nextflush <= 0 || !vcount) {
164                                  if (nproc > 1 && ray_fifo_flush() < 0)
165 <                                        error(USER, "lost children");
165 >                                        error(USER, "child(ren) died");
166                                  bogusray();
167                                  fflush(stdout);
168                                  nextflush = (vresolu > 0) & (hresolu > 1) ? 0 :
# Line 174 | Line 174 | rtrace(                                /* trace rays from file */
174                                                          /* flush if time */
175                          if (!--nextflush) {
176                                  if (nproc > 1 && ray_fifo_flush() < 0)
177 <                                        error(USER, "lost children");
177 >                                        error(USER, "child(ren) died");
178                                  fflush(stdout);
179                                  nextflush = hresolu;
180                          }
# Line 410 | Line 410 | getvec(                /* get a vector from fp */
410                  }
411                  break;
412          case 'f':                                       /* binary float */
413 <                if (fread((char *)vf, sizeof(float), 3, fp) != 3)
413 >                if (getbinary(vf, sizeof(float), 3, fp) != 3)
414                          return(-1);
415                  VCOPY(vec, vf);
416                  break;
417          case 'd':                                       /* binary double */
418 <                if (fread((char *)vd, sizeof(double), 3, fp) != 3)
418 >                if (getbinary(vd, sizeof(double), 3, fp) != 3)
419                          return(-1);
420                  VCOPY(vec, vd);
421                  break;
# Line 519 | Line 519 | oputv(                         /* print value */
519                  setcolr(cout,   colval(r->rcol,RED),
520                                  colval(r->rcol,GRN),
521                                  colval(r->rcol,BLU));
522 <                fwrite(cout, sizeof(cout), 1, stdout);
522 >                putbinary(cout, sizeof(cout), 1, stdout);
523                  return;
524          }
525          cval[0] = colval(r->rcol,RED);
# Line 642 | Line 642 | oputW(                         /* print coefficient */
642   )
643   {
644          RREAL   contr[3];
645 +                                /* shadow ray not on source? */
646 +        if (r->rsrc >= 0 && source[r->rsrc].so != r->ro)
647 +                setcolor(contr, 0.0, 0.0, 0.0);
648 +        else
649 +                raycontrib(contr, r, PRIMARY);
650  
646        raycontrib(contr, r, PRIMARY);
651          (*putreal)(contr, 3);
652   }
653  
# Line 708 | Line 712 | puta(                          /* print ascii value(s) */
712   static void
713   putd(RREAL *v, int n)           /* print binary double(s) */
714   {
715 <        if (sizeof(RREAL) != sizeof(double))
715 > #ifdef  SMLFLT
716 >        double  da[3];
717 >        int     i;
718 >
719 >        if (n > 3)
720                  error(INTERNAL, "code error in putd()");
721 <        fwrite(v, sizeof(RREAL), n, stdout);
721 >        for (i = n; i--; )
722 >                da[i] = v[i];
723 >        putbinary(da, sizeof(double), n, stdout);
724 > #else
725 >        putbinary(v, sizeof(RREAL), n, stdout);
726 > #endif
727   }
728  
729  
730   static void
731   putf(RREAL *v, int n)           /* print binary float(s) */
732   {
733 + #ifndef SMLFLT
734          float   fa[3];
735          int     i;
736  
# Line 724 | Line 738 | putf(RREAL *v, int n)          /* print binary float(s) */
738                  error(INTERNAL, "code error in putf()");
739          for (i = n; i--; )
740                  fa[i] = v[i];
741 <        fwrite(fa, sizeof(float), n, stdout);
741 >        putbinary(fa, sizeof(float), n, stdout);
742 > #else
743 >        putbinary(v, sizeof(RREAL), n, stdout);
744 > #endif
745   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines