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

Comparing ray/src/rt/rpict.c (file contents):
Revision 2.43 by greg, Wed Feb 7 16:35:18 1996 UTC vs.
Revision 2.48 by gregl, Mon Oct 20 16:46:37 1997 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1995 Regents of the University of California */
1 > /* Copyright (c) 1996 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 6 | Line 6 | static char SCCSid[] = "$SunId$ LBL";
6  
7   /*
8   *  rpict.c - routines and variables for picture generation.
9 *
10 *     8/14/85
9   */
10  
11   #include  "ray.h"
# Line 64 | Line 62 | int  directvis = 1;                    /* sources visible? */
62   double  srcsizerat = .25;               /* maximum ratio source size/dist. */
63  
64   COLOR  cextinction = BLKCOLOR;          /* global extinction coefficient */
65 < double  salbedo = 0.;                   /* global scattering albedo */
65 > COLOR  salbedo = BLKCOLOR;              /* global scattering albedo */
66   double  seccg = 0.;                     /* global scattering eccentricity */
67   double  ssampdist = 0.;                 /* scatter sampling distance */
68  
# Line 77 | Line 75 | int  maxdepth = 6;                     /* maximum recursion depth */
75   double  minweight = 5e-3;               /* minimum ray weight */
76  
77   COLOR  ambval = BLKCOLOR;               /* ambient value */
78 + int  ambvwt = 0;                        /* initial weight for ambient value */
79   double  ambacc = 0.2;                   /* ambient accuracy */
80   int  ambres = 32;                       /* ambient resolution */
81   int  ambdiv = 128;                      /* ambient divisions */
# Line 103 | Line 102 | extern unsigned long  nrays;           /* number of rays traced
102  
103   #define  pixjitter()    (.5+dstrpix*(.5-frandom()))
104  
105 < static int  hres, vres;                 /* resolution for this frame */
105 > int  hres, vres;                        /* resolution for this frame */
106  
107   extern char  *mktemp();
108  
# Line 404 | Line 403 | char  *zfile, *oldfile;
403          else
404   #endif
405          signal(SIGCONT, report);
406 <        ypos = vres-1 - i;
406 >        ypos = vres-1 - i;                      /* initialize sampling */
407 >        if (directvis)
408 >                init_drawsources(psample);
409          fillscanline(scanbar[0], zbar[0], sampdens, hres, ypos, hstep);
410                                                  /* compute scanlines */
411          for (ypos -= ystep; ypos > -ystep; ypos -= ystep) {
# Line 424 | Line 425 | char  *zfile, *oldfile;
425                                  hres, ypos, hstep);
426                                                          /* fill bar */
427                  fillscanbar(scanbar, zbar, hres, ypos, ystep);
428 +                if (directvis)                          /* add bitty sources */
429 +                        drawsources(scanbar, zbar, 0, hres, ypos, ystep);
430                                                          /* write it out */
431   #ifndef  BSD
432                  signal(SIGCONT, SIG_IGN);       /* don't interrupt writes */
# Line 488 | Line 491 | int  xres, y, xstep;
491          int  bl = xstep, b = xstep;
492          double  z;
493          register int  i;
494 <        
494 >
495          z = pixvalue(scanline[0], 0, y);
496          if (zline) zline[0] = z;
497                                  /* zig-zag start for quincunx pattern */
# Line 522 | Line 525 | int  xres, y, ysize;
525          float  zline[MAXDIV+1];
526          int  b = ysize;
527          register int  i, j;
528 <        
528 >
529          for (i = 0; i < xres; i++) {
527                
530                  copycolor(vline[0], scanbar[0][i]);
531                  copycolor(vline[ysize], scanbar[ysize][i]);
532                  if (zbar[0]) {
533                          zline[0] = zbar[0][i];
534                          zline[ysize] = zbar[ysize][i];
535                  }
534                
536                  b = fillsample(vline, zbar[0] ? zline : (float *)NULL,
537                                  i, y, 0, ysize, b/2);
538 <                
538 >
539                  for (j = 1; j < ysize; j++)
540                          copycolor(scanbar[j][i], vline[j]);
541                  if (zbar[0])
# Line 557 | Line 558 | int  b;
558          COLOR  ctmp;
559          int  ncut;
560          register int  len;
561 <        
561 >
562          if (xlen > 0)                   /* x or y length is zero */
563                  len = xlen;
564          else
565                  len = ylen;
566 <                
566 >
567          if (len <= 1)                   /* limit recursion */
568                  return(0);
569 <        
570 <        if (b > 0
571 <        || (zline && 2.*fabs(zline[0]-zline[len]) > maxdiff*(zline[0]+zline[len]))
569 >
570 >        if (b > 0 ||
571 >        (zline && 2.*fabs(zline[0]-zline[len]) > maxdiff*(zline[0]+zline[len]))
572                          || bigdiff(colline[0], colline[len], maxdiff)) {
573 <        
573 >
574                  z = pixvalue(colline[len>>1], x + (xlen>>1), y + (ylen>>1));
575                  if (zline) zline[len>>1] = z;
576                  ncut = 1;
576                
577          } else {                                        /* interpolate */
578        
578                  copycolor(colline[len>>1], colline[len]);
579                  ratio = (double)(len>>1) / len;
580                  scalecolor(colline[len>>1], ratio);
# Line 589 | Line 588 | int  b;
588          }
589                                                          /* recurse */
590          ncut += fillsample(colline, zline, x, y, xlen>>1, ylen>>1, (b-1)/2);
591 <        
591 >
592          ncut += fillsample(colline+(len>>1),
593                          zline ? zline+(len>>1) : (float *)NULL,
594                          x+(xlen>>1), y+(ylen>>1),
# Line 619 | Line 618 | int  x, y;                     /* pixel position */
618          rayvalue(&thisray);                     /* trace ray */
619  
620          copycolor(col, thisray.rcol);           /* return color */
621 <        
621 >
622          return(thisray.rt);                     /* return distance */
623   }
624  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines