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.67 by greg, Wed Jun 27 15:32:58 2012 UTC vs.
Revision 2.72 by greg, Thu Nov 8 00:54:07 2018 UTC

# Line 28 | Line 28 | static const char      RCSid[] = "$Id$";
28   #include  "ambient.h"
29   #include  "source.h"
30   #include  "otypes.h"
31 + #include  "otspecial.h"
32   #include  "resolu.h"
33   #include  "random.h"
34  
# Line 162 | Line 163 | rtrace(                                /* trace rays from file */
163                  if (d == 0.0) {                         /* zero ==> flush */
164                          if (--nextflush <= 0 || !vcount) {
165                                  if (nproc > 1 && ray_fifo_flush() < 0)
166 <                                        error(USER, "lost children");
166 >                                        error(USER, "child(ren) died");
167                                  bogusray();
168                                  fflush(stdout);
169                                  nextflush = (vresolu > 0) & (hresolu > 1) ? 0 :
# Line 174 | Line 175 | rtrace(                                /* trace rays from file */
175                                                          /* flush if time */
176                          if (!--nextflush) {
177                                  if (nproc > 1 && ray_fifo_flush() < 0)
178 <                                        error(USER, "lost children");
178 >                                        error(USER, "child(ren) died");
179                                  fflush(stdout);
180                                  nextflush = hresolu;
181                          }
# Line 410 | Line 411 | getvec(                /* get a vector from fp */
411                  }
412                  break;
413          case 'f':                                       /* binary float */
414 <                if (fread((char *)vf, sizeof(float), 3, fp) != 3)
414 >                if (getbinary(vf, sizeof(float), 3, fp) != 3)
415                          return(-1);
416                  VCOPY(vec, vf);
417                  break;
418          case 'd':                                       /* binary double */
419 <                if (fread((char *)vd, sizeof(double), 3, fp) != 3)
419 >                if (getbinary(vd, sizeof(double), 3, fp) != 3)
420                          return(-1);
421                  VCOPY(vec, vd);
422                  break;
# Line 519 | Line 520 | oputv(                         /* print value */
520                  setcolr(cout,   colval(r->rcol,RED),
521                                  colval(r->rcol,GRN),
522                                  colval(r->rcol,BLU));
523 <                fwrite(cout, sizeof(cout), 1, stdout);
523 >                putbinary(cout, sizeof(cout), 1, stdout);
524                  return;
525          }
526          cval[0] = colval(r->rcol,RED);
# Line 712 | Line 713 | puta(                          /* print ascii value(s) */
713   static void
714   putd(RREAL *v, int n)           /* print binary double(s) */
715   {
716 <        if (sizeof(RREAL) != sizeof(double))
716 > #ifdef  SMLFLT
717 >        double  da[3];
718 >        int     i;
719 >
720 >        if (n > 3)
721                  error(INTERNAL, "code error in putd()");
722 <        fwrite(v, sizeof(RREAL), n, stdout);
722 >        for (i = n; i--; )
723 >                da[i] = v[i];
724 >        putbinary(da, sizeof(double), n, stdout);
725 > #else
726 >        putbinary(v, sizeof(RREAL), n, stdout);
727 > #endif
728   }
729  
730  
731   static void
732   putf(RREAL *v, int n)           /* print binary float(s) */
733   {
734 + #ifndef SMLFLT
735          float   fa[3];
736          int     i;
737  
# Line 728 | Line 739 | putf(RREAL *v, int n)          /* print binary float(s) */
739                  error(INTERNAL, "code error in putf()");
740          for (i = n; i--; )
741                  fa[i] = v[i];
742 <        fwrite(fa, sizeof(float), n, stdout);
742 >        putbinary(fa, sizeof(float), n, stdout);
743 > #else
744 >        putbinary(v, sizeof(RREAL), n, stdout);
745 > #endif
746   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines