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

Comparing ray/src/px/pinterp.c (file contents):
Revision 2.47 by greg, Thu Aug 2 18:33:45 2018 UTC vs.
Revision 2.50 by greg, Thu May 14 20:51:02 2020 UTC

# Line 28 | Line 28 | static const char      RCSid[] = "$Id$";
28   #define averaging       (ourweigh != NULL)
29   #define blurring        (ourbpict != NULL)
30   #define usematrix       (hasmatrix & !averaging)
31 < #define zisnorm         ((!usematrix) | (ourview.type != VT_PER))
31 > #define zisnorm         (!usematrix | (ourview.type != VT_PER))
32  
33   #define MAXWT           1000.           /* maximum pixel weight (averaging) */
34  
# Line 497 | Line 497 | addpicture(            /* add picture to output */
497          zin = (float *)malloc(scanlen(&tresolu)*sizeof(float));
498          if (zin == NULL)
499                  syserror(progname);
500 <        if ((zfd = open(zspec, O_RDONLY)) == -1) {
501 <                double  zvalue;
500 >        if (isflt(zspec)) {             /* depth is a constant? */
501 >                double  zvalue = atof(zspec);
502                  int     x;
503 <                if (!isflt(zspec) || (zvalue = atof(zspec)) <= 0.0)
504 <                        syserror(zspec);
503 >                if (zvalue <= 0.0) {
504 >                        fprintf(stderr, "%s: illegal Z-value %s\n",
505 >                                        progname, zspec);
506 >                        exit(1);
507 >                }
508                  for (x = scanlen(&tresolu); x-- > 0; )
509                          zin[x] = zvalue;
510 <        }
510 >                zfd = -1;
511 >        } else if ((zfd = open_float_depth(zspec, (long)tresolu.xr*tresolu.yr)) < 0)
512 >                exit(1);
513                                          /* compute transferrable perimeter */
514          xlim = (struct bound *)malloc(numscans(&tresolu)*sizeof(struct bound));
515          if (xlim == NULL)
# Line 748 | Line 753 | movepixel(                             /* reposition image point */
753                  }
754                  pos[0] += .5 - ourview.hoff;
755                  pos[1] += .5 - ourview.voff;
756 +                if ((pos[0] < 0) | (pos[0] >= 1-FTINY) |
757 +                                (pos[1] < 0) | (pos[1] >= 1-FTINY))
758 +                        return(0);
759                  pos[2] -= ourview.vfore;
760          } else {
761                  if (viewray(pt, tdir, &theirview, pos[0], pos[1]) < -FTINY)
762                          return(0);
763 <                if ((!normdist) & (theirview.type == VT_PER))   /* adjust */
763 >                if (!normdist & (theirview.type == VT_PER))     /* adjust */
764                          pos[2] /= DOT(theirview.vdir, tdir);
765                  pt[0] += tdir[0]*pos[2];
766                  pt[1] += tdir[1]*pos[2];
767                  pt[2] += tdir[2]*pos[2];
768 <                if (viewloc(pos, &ourview, pt) <= 0)
768 >                if (viewloc(pos, &ourview, pt) != VL_GOOD)
769                          return(0);
770          }
763        if ((pos[0] < 0) | (pos[0] >= 1-FTINY) | (pos[1] < 0) | (pos[1] >= 1-FTINY))
764                return(0);
771          if (!averaging)
772                  return(1);
773                                                  /* compute pixel weight */
# Line 1162 | Line 1168 | calstart(                    /* start fill calculation
1168          int     rval;
1169          char    **wp, *cp;
1170  
1171 <        if (PDesc.running) {
1171 >        if (PDesc.flags & PF_RUNNING) {
1172                  fprintf(stderr, "%s: too many calculations\n", progname);
1173                  exit(1);
1174          }
# Line 1197 | Line 1203 | calstart(                    /* start fill calculation
1203   static void
1204   caldone(void)                               /* done with calculation */
1205   {
1206 <        if (!PDesc.running)
1206 >        if (!(PDesc.flags & PF_RUNNING))
1207                  return;
1208          clearqueue();
1209          close_process(&PDesc);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines