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.32 by greg, Mon Nov 22 09:34:15 1993 UTC vs.
Revision 2.41 by greg, Fri Dec 8 18:49:20 1995 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1992 Regents of the University of California */
1 > /* Copyright (c) 1995 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 21 | Line 21 | static char SCCSid[] = "$SunId$ LBL";
21   #else
22   #include  <sys/times.h>
23   #include  <sys/utsname.h>
24 < #include  <limits.h>
24 > #include  <unistd.h>
25   #endif
26   #endif
27  
# Line 64 | Line 64 | int  vspretest = 512;                  /* virtual source pretest dens
64   int  directvis = 1;                     /* sources visible? */
65   double  srcsizerat = .25;               /* maximum ratio source size/dist. */
66  
67 + COLOR  cextinction = BLKCOLOR;          /* global extinction coefficient */
68 + double  salbedo = 0.;                   /* global scattering albedo */
69 + double  seccg = 0.;                     /* global scattering eccentricity */
70 + double  ssampdist = 0.;                 /* scatter sampling distance */
71 +
72   double  specthresh = .15;               /* specular sampling threshold */
73   double  specjitter = 1.;                /* specular sampling jitter */
74  
75 + int  backvis = 1;                       /* back face visibility */
76 +
77   int  maxdepth = 6;                      /* maximum recursion depth */
78   double  minweight = 5e-3;               /* minimum ray weight */
79  
# Line 140 | Line 147 | report()               /* report progress */
147   #else
148          struct tms  tbuf;
149          struct utsname  nambuf;
150 < #define hostname  nambuf.sysname
150 >        double  period;
151 > #define hostname  nambuf.nodename
152   #endif
153  
154          tlastrept = time((time_t *)NULL);
# Line 154 | Line 162 | report()               /* report progress */
162          gethostname(hostname, sizeof(hostname));
163   #else
164          times(&tbuf);
165 <        u = ( tbuf.tms_utime + tbuf.tms_cutime ) / CLK_TCK;
166 <        s = ( tbuf.tms_stime + tbuf.tms_cstime ) / CLK_TCK;
165 > #ifdef _SC_CLK_TCK
166 >        period = 1.0 / sysconf(_SC_CLK_TCK);
167 > #else
168 >        period = 1.0 / 60.0;
169 > #endif
170 >        u = ( tbuf.tms_utime + tbuf.tms_cutime ) * period;
171 >        s = ( tbuf.tms_stime + tbuf.tms_cstime ) * period;
172          uname(&nambuf);
173   #endif
174  
# Line 164 | Line 177 | report()               /* report progress */
177                          nrays, pctdone, u/3600., s/3600.,
178                          (tlastrept-tstart)/3600., hostname);
179          eputs(errmsg);
180 + #ifndef BSD
181 +        signal(SIGCONT, report);
182   #undef hostname
183 + #endif
184   }
185   #else
186   report()                /* report progress */
# Line 173 | Line 189 | report()               /* report progress */
189          sprintf(errmsg, "%lu rays, %4.2f%% after %5.4f hours\n",
190                          nrays, pctdone, (tlastrept-tstart)/3600.0);
191          eputs(errmsg);
176        signal(SIGCONT, report);
192   }
193   #endif
194  
# Line 492 | Line 507 | int  xres, y, xstep;
507                          b = fillsample(scanline, zline, 0, y, i, 0, b/2);
508                  else
509                          b = fillsample(scanline+i-xstep,
510 <                                        zline ? zline+i-xstep : NULL,
510 >                                        zline ? zline+i-xstep : (float *)NULL,
511                                          i-xstep, y, xstep, 0, b/2);
512                  if (sd) *sd++ = nc & 1 ? bl : b;
513                  bl = b;
# Line 520 | Line 535 | int  xres, y, ysize;
535                          zline[ysize] = zbar[ysize][i];
536                  }
537                  
538 <                b = fillsample(vline, zbar[0] ? zline : NULL,
538 >                b = fillsample(vline, zbar[0] ? zline : (float *)NULL,
539                                  i, y, 0, ysize, b/2);
540                  
541                  for (j = 1; j < ysize; j++)
# Line 578 | Line 593 | int  b;
593                                                          /* recurse */
594          ncut += fillsample(colline, zline, x, y, xlen>>1, ylen>>1, (b-1)/2);
595          
596 <        ncut += fillsample(colline+(len>>1), zline ? zline+(len>>1) : NULL,
596 >        ncut += fillsample(colline+(len>>1),
597 >                        zline ? zline+(len>>1) : (float *)NULL,
598                          x+(xlen>>1), y+(ylen>>1),
599                          xlen-(xlen>>1), ylen-(ylen>>1), b/2);
600  
# Line 593 | Line 609 | int  x, y;                     /* pixel position */
609   {
610          static RAY  thisray;
611  
612 <        if (viewray(thisray.rorg, thisray.rdir, &ourview,
613 <                        (x+pixjitter())/hres, (y+pixjitter())/vres) < 0) {
612 >        if ((thisray.rmax = viewray(thisray.rorg, thisray.rdir, &ourview,
613 >                        (x+pixjitter())/hres, (y+pixjitter())/vres)) < -FTINY) {
614                  setcolor(col, 0.0, 0.0, 0.0);
615                  return(0.0);
616          }
# Line 620 | Line 636 | char  *oldfile;
636          int  x, y;
637  
638          if (oldfile == NULL)
639 <                return(0);
640 <        
639 >                goto gotzip;
640 >
641          if ((fp = fopen(oldfile, "r")) == NULL) {
642                  sprintf(errmsg, "cannot open recover file \"%s\"", oldfile);
643                  error(WARNING, errmsg);
644 <                return(0);
644 >                goto gotzip;
645          }
646   #ifdef MSDOS
647          setmode(fileno(fp), O_BINARY);
# Line 638 | Line 654 | char  *oldfile;
654                                  oldfile);
655                  error(WARNING, errmsg);
656                  fclose(fp);
657 <                return(0);
657 >                goto gotzip;
658          }
659  
660          if (x != hres || y != vres) {
# Line 662 | Line 678 | char  *oldfile;
678          fclose(fp);
679          unlink(oldfile);
680          return(y);
681 + gotzip:
682 +        if (fflush(stdout) == EOF)
683 +                error(SYSTEM, "error writing picture header");
684 +        return(0);
685   writerr:
686          sprintf(errmsg, "write error during recovery of \"%s\"", oldfile);
687          error(SYSTEM, errmsg);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines