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

Comparing ray/src/util/glareval.c (file contents):
Revision 2.11 by schorsch, Fri Jan 2 12:48:36 2004 UTC vs.
Revision 2.18 by greg, Thu May 14 20:58:03 2020 UTC

# Line 10 | Line 10 | static const char      RCSid[] = "$Id$";
10   #include <stdlib.h>
11   #include <string.h>
12  
13 + #include "platform.h"
14   #include "rtprocess.h" /* Windows: must come first because of conflicts */
15   #include "glare.h"
16  
# Line 144 | Line 145 | seekerr:
145  
146  
147   #ifdef DEBUG
148 < static void
148 > void
149   pict_stats(void)                        /* print out picture read statistics */
150   {
151          static long     lastcall = 0L;  /* ncall at last report */
# Line 176 | Line 177 | pict_val(                      /* find picture value for view direction *
177          pp[0] = pictview.vp[0] + vd[0];
178          pp[1] = pictview.vp[1] + vd[1];
179          pp[2] = pictview.vp[2] + vd[2];
180 <        viewloc(ip, &pictview, pp);
180 <        if (ip[2] <= FTINY || ip[0] < 0. || ip[0] >= 1. ||
181 <                        ip[1] < 0. || ip[1] >= 1.)
180 >        if (viewloc(ip, &pictview, pp) != VL_GOOD)
181                  return(-1.0);
182          colr_color(res, getpictscan((int)(ip[1]*pysiz))[(int)(ip[0]*pxsiz)]);
183          return(luminance(res)/exposure);
# Line 200 | Line 199 | getviewpix(            /* compute single view pixel */
199          npixinvw++;
200          if ((res = pict_val(dir)) >= 0.0)
201                  return(res);
202 <        if (rt_pd.r == -1) {
202 >        if (!(rt_pd.flags & PF_RUNNING)) {
203                  npixmiss++;
204                  return(-1.0);
205          }
# Line 241 | Line 240 | getviewspan(           /* compute a span of view pixels */
240                  npixinvw++;
241                  if ((vb[vh+hsize] = pict_val(dir)) >= 0.0)
242                          continue;
243 <                if (rt_pd.r == -1) {            /* missing information */
243 >                if (!(rt_pd.flags & PF_RUNNING)) {      /* missing information */
244                          npixmiss++;
245                          continue;
246                  }
247                                                  /* send to rtrace */
248                  if (n >= maxpix) {                      /* flush */
249                          rt_compute(rt_buf, n);
250 <                        while (n-- > 0)
250 >                        while (n > 0) {
251 >                                --n;
252                                  vb[buf_vh[n]+hsize] = luminance(rt_buf+3*n);
253 +                        }
254                  }
255                  rt_buf[6*n] = ourview.vp[0];
256                  rt_buf[6*n+1] = ourview.vp[1];
# Line 298 | Line 299 | getexpos(                      /* get exposure from header line */
299          void    *p
300   )
301   {
302 <        char    fmt[32];
302 >        char    fmt[MAXFMTLEN];
303  
304          if (isexpos(s))
305                  exposure *= exposval(s);
# Line 319 | Line 320 | open_pict(                     /* open picture file */
320                  fprintf(stderr, "%s: cannot open\n", fn);
321                  exit(1);
322          }
323 +        SET_FILE_BINARY(pictfp);
324          exposure = 1.0;
325          getheader(pictfp, getexpos, NULL);
326          if (wrongformat || !fscnresolu(&pxsiz, &pysiz, pictfp)) {
# Line 374 | Line 376 | done_rtrace(void)                      /* wait for rtrace to finish */
376                                  progname, status);
377                  exit(1);
378          }
377        rt_pd.r = -1;
379   }
380  
381  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines