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.91 by greg, Sun Apr 5 15:47:02 2020 UTC vs.
Revision 2.98 by greg, Tue Jun 16 17:58:11 2020 UTC

# Line 45 | Line 45 | extern int  traincl;                   /* include == 1, exclude == 0 *
45   extern int  hresolu;                    /* horizontal resolution */
46   extern int  vresolu;                    /* vertical resolution */
47  
48 < static int  castonly = 0;
48 > int  castonly = 0;                      /* only doing ray-casting? */
49  
50   #ifndef  MAXTSET
51   #define  MAXTSET        8191            /* maximum number in trace set */
# Line 68 | Line 68 | static oputf_t  oputo, oputd, oputv, oputV, oputl, opu
68                  oputr, oputR, oputx, oputX, oputn, oputN, oputs,
69                  oputw, oputW, oputm, oputM, oputtilde;
70  
71 static void setoutput(char *vs);
71   extern void tranotify(OBJECT obj);
72 + static int is_fifo(FILE *fp);
73   static void bogusray(void);
74   static void raycast(RAY *r);
75   static void rayirrad(RAY *r);
# Line 117 | Line 117 | formstr(                               /* return format identifier */
117   }
118  
119  
120 < extern void
120 > void
121   rtrace(                         /* trace rays from file */
122          char  *fname,
123          int  nproc
# Line 144 | Line 144 | rtrace(                                /* trace rays from file */
144          if (inform != 'a')
145                  SET_FILE_BINARY(inpfp);
146                                          /* set up output */
147 <        if (imm_irrad)
148 <                castonly = 0;
149 <        else if (castonly || every_out[0] != NULL)
147 >        if (castonly || every_out[0] != NULL)
148                  nproc = 1;              /* don't bother multiprocessing */
149          if ((nextflush > 0) & (nproc > nextflush)) {
150                  error(WARNING, "reducing number of processes to match flush interval");
# Line 237 | Line 235 | setrtoutput(void)                      /* set up output tables, return #c
235          if (!*vs)
236                  error(USER, "empty output specification");
237  
238 <        castonly = 1;
238 >        castonly = 1;                   /* sets castonly as side-effect */
239          do
240                  switch (*vs) {
241                  case 'T':                               /* trace sources */
# Line 287 | Line 285 | setrtoutput(void)                      /* set up output tables, return #c
285                  case 'V':                               /* contribution */
286                          *table++ = oputV;
287                          ncomp += 3;
288 +                        castonly = 0;
289                          if (ambounce > 0 && (ambacc > FTINY || ambssamp > 0))
290                                  error(WARNING,
291                                          "-otV accuracy depends on -aa 0 -as 0");
# Line 354 | Line 353 | setrtoutput(void)                      /* set up output tables, return #c
353          if (*every_out != NULL)
354                  ncomp = 0;
355                                                          /* compatibility */
356 +        if ((do_irrad | imm_irrad) && castonly)
357 +                error(USER, "-I+ and -i+ options require some value output");
358          for (table = ray_out; *table != NULL; table++) {
359                  if ((*table == oputV) | (*table == oputW))
360                          error(WARNING, "-oVW options require trace mode");
# Line 461 | Line 462 | printvals(                     /* print requested ray values */
462  
463  
464   static int
465 + is_fifo(                /* check if file pointer connected to pipe */
466 +        FILE *fp
467 + )
468 + {
469 + #ifdef S_ISFIFO
470 +        struct stat  sbuf;
471 +
472 +        if (fstat(fileno(fp), &sbuf) < 0)
473 +                error(SYSTEM, "fstat() failed on input stream");
474 +        return(S_ISFIFO(sbuf.st_mode));
475 + #else
476 +        return (fp == stdin);           /* just a guess, really */
477 + #endif
478 + }
479 +
480 +
481 + static int
482   getvec(                 /* get a vector from fp */
483          FVECT  vec,
484          int  fmt,
# Line 524 | Line 542 | nextray(               /* return next ray in work group (-1.0 if EO
542                  int     rsiz = 6*20;    /* conservative ascii ray size */
543                  if (inform == 'f') rsiz = 6*sizeof(float);
544                  else if (inform == 'd') rsiz = 6*sizeof(double);
545 <                if ((inpfp == stdin) & (qlength*rsiz > 512))    /* pipe limit */
545 >                                        /* check against pipe limit */
546 >                if (qlength*rsiz > 512 && is_fifo(inpfp))
547                          inp_queue = (FVECT *)malloc(sizeof(FVECT)*2*qlength);
548                  inp_qend = -(inp_queue == NULL);        /* flag for no queue */
549          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines