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 1.25 by greg, Tue Mar 6 11:14:36 1990 UTC vs.
Revision 1.26 by greg, Tue Mar 6 12:04:56 1990 UTC

# Line 16 | Line 16 | static char SCCSid[] = "$SunId$ LBL";
16  
17   #include "color.h"
18  
19 #include "random.h"
20
19   #ifndef BSD
20   #define vfork           fork
21   #endif
# Line 25 | Line 23 | static char SCCSid[] = "$SunId$ LBL";
23   #define pscan(y)        (ourpict+(y)*hresolu)
24   #define zscan(y)        (ourzbuf+(y)*hresolu)
25  
28 #define PMASK           0xfffffff       /* probability mask */
29 #define sampval(x)      (long)((x)*(PMASK+1)+.5)
30 #define samp(p)         ((p) > (random()&PMASK))
31
26   #define F_FORE          1               /* fill foreground */
27   #define F_BACK          2               /* fill background */
28  
# Line 53 | Line 47 | float  *ourzbuf;                       /* corresponding z-buffer */
47   char    *progname;
48  
49   int     fillo = F_FORE|F_BACK;          /* selected fill options */
50 < long    sampprob = 0;                   /* sample probability */
50 > int     fillsamp = 0;                   /* sample separation (0 == inf) */
51   extern int      backfill(), rcalfill(); /* fill functions */
52   int     (*fillfunc)() = backfill;       /* selected fill function */
53   COLR    backcolr = BLKCOLR;             /* background color */
# Line 121 | Line 115 | char   *argv[];
115                                  break;
116                          case 's':                               /* sample */
117                                  check(3,1);
118 <                                sampprob = sampval(atof(argv[++i]));
118 >                                fillsamp = atoi(argv[++i]);
119                                  break;
120                          case 'c':                               /* color */
121                                  check(3,3);
# Line 200 | Line 194 | char   *argv[];
194                  addpicture(argv[i], argv[i+1]);
195                                                          /* fill in spaces */
196          if (fillo&F_BACK)
197 <                backpicture(fillfunc, sampprob);
197 >                backpicture(fillfunc, fillsamp);
198          else
199                  fillpicture(fillfunc);
200                                                          /* close calculation */
# Line 471 | Line 465 | double z;
465   }
466  
467  
468 < backpicture(fill, prob)                 /* background fill algorithm */
468 > backpicture(fill, samp)                 /* background fill algorithm */
469   int     (*fill)();
470 < long    prob;
470 > int     samp;
471   {
472          int     *yback, xback;
473          int     y;
# Line 524 | Line 518 | long   prob;
518                                                  xback = x-1;
519                                  }
520                                  /*
521 <                                 * Check to see if we have no background for
522 <                                 * this pixel.  If not, or sampling was
523 <                                 * requested, use the given fill function.
521 >                                 * If we have no background for this pixel,
522 >                                 * or if the background is too distant,
523 >                                 * use the given fill function.
524                                   */
525 <                                if ((xback < 0 && yback[x] < 0) || samp(prob)) {
525 >                                if ((xback < 0 && yback[x] < 0)
526 >                                        || (samp > 0
527 >                                                && ABS(x-xback) >= samp
528 >                                                && ABS(y-yback[y]) >= samp)) {
529                                          (*fill)(x,y);
530 +                                        if (fill != backfill) { /* reuse */
531 +                                                yback[x] = -2;
532 +                                                xback = -2;
533 +                                        }
534                                          continue;
535                                  }
536                                  /*

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines