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 1.26 by greg, Tue Jun 18 10:27:16 1991 UTC vs.
Revision 1.35 by greg, Mon Oct 21 12:57:57 1991 UTC

# Line 15 | Line 15 | static char SCCSid[] = "$SunId$ LBL";
15   #ifdef BSD
16   #include  <sys/time.h>
17   #include  <sys/resource.h>
18 #else
19 #include  <signal.h>
18   #endif
19 +
20 + #include  <signal.h>
21   #include  <fcntl.h>
22  
23   #include  "view.h"
# Line 40 | Line 40 | double  dstrpix = 0.67;                        /* square pixel distribution
40   double  dstrsrc = 0.0;                  /* square source distribution */
41   double  shadthresh = .05;               /* shadow threshold */
42   double  shadcert = .5;                  /* shadow certainty */
43 + int  directrelay = 1;                   /* number of source relays */
44 + int  vspretest = 512;                   /* virtual source pretest density */
45 + int  directinvis = 0;                   /* sources invisible? */
46 + double  srcsizerat = .25;               /* maximum ratio source size/dist. */
47  
48   int  maxdepth = 6;                      /* maximum recursion depth */
49   double  minweight = 5e-3;               /* minimum ray weight */
# Line 119 | Line 123 | char  *zfile, *oldfile;
123          float  *zbar[MAXDIV+1];         /* z values */
124          int  ypos;                      /* current scanline */
125          int  ystep;                     /* current y step size */
126 +        int  hstep;                     /* h step size */
127          int  zfd;
128          COLOR  *colptr;
129          float  *zptr;
# Line 164 | Line 169 | char  *zfile, *oldfile;
169          pctdone = 100.0*i/vresolu;
170          if (ralrm > 0)                  /* report init stats */
171                  report();
172 + #ifndef  BSD
173 +        else
174 + #endif
175 +        signal(SIGALRM, report);
176          ypos = vresolu-1 - i;
177 <        fillscanline(scanbar[0], zbar[0], hresolu, ypos, psample);
178 <        ystep = psample;
177 >        hstep = (psample*140+49)/99;            /* quincunx sampling */
178 >        ystep = (psample*99+70)/140;
179 >        fillscanline(scanbar[0], zbar[0], hresolu, ypos, hstep);
180                                                  /* compute scanlines */
181          for (ypos -= ystep; ypos > -ystep; ypos -= ystep) {
182                                                          /* bottom adjust? */
# Line 181 | Line 191 | char  *zfile, *oldfile;
191                  zbar[ystep] = zbar[0];
192                  zbar[0] = zptr;
193                                                          /* fill base line */
194 <                fillscanline(scanbar[0], zbar[0], hresolu, ypos, psample);
194 >                fillscanline(scanbar[0], zbar[0], hresolu, ypos, hstep);
195                                                          /* fill bar */
196                  fillscanbar(scanbar, zbar, hresolu, ypos, ystep);
197                                                          /* write it out */
198 + #ifndef  BSD
199 +                signal(SIGALRM, SIG_IGN);       /* don't interrupt writes */
200 + #endif
201                  for (i = ystep; i > 0; i--) {
202                          if (zfd != -1 && write(zfd, (char *)zbar[i],
203                                          hresolu*sizeof(float))
# Line 199 | Line 212 | char  *zfile, *oldfile;
212                  pctdone = 100.0*(vresolu-1-ypos)/vresolu;
213                  if (ralrm > 0 && time((long *)0) >= tlastrept+ralrm)
214                          report();
215 + #ifndef  BSD
216 +                else
217 +                        signal(SIGALRM, report);
218 + #endif
219          }
220                                                  /* clean up */
221          if (zfd != -1) {
# Line 229 | Line 246 | register COLOR  *scanline;
246   register float  *zline;
247   int  xres, y, xstep;
248   {
249 +        static int  nc = 0;             /* number of calls */
250          int  b = xstep;
251          double  z;
252          register int  i;
253          
254          z = pixvalue(scanline[0], 0, y);
255          if (zline) zline[0] = z;
256 <
257 <        for (i = xstep; i < xres-1+xstep; i += xstep) {
256 >                                /* zig-zag start for quincunx pattern */
257 >        for (i = nc++ & 1 ? xstep/2 : xstep; i < xres-1+xstep; i += xstep) {
258                  if (i >= xres) {
259                          xstep += xres-1-i;
260                          i = xres-1;
# Line 351 | Line 369 | int  x, y;                     /* pixel position */
369  
370          rayorigin(&thisray, NULL, PRIMARY, 1.0);
371  
372 <        samplendx = 3*y + x;                    /* set pixel index */
372 >        samplendx = pixnumber(x,y,hresolu,vresolu);     /* set pixel index */
373  
374          rayvalue(&thisray);                     /* trace ray */
375  
# Line 410 | Line 428 | char  *oldfile;
428          return(y);
429   writerr:
430          error(SYSTEM, "write error in salvage");
431 + }
432 +
433 +
434 + int
435 + pixnumber(x, y, xres, yres)             /* compute pixel index (brushed) */
436 + register int  x, y;
437 + int  xres, yres;
438 + {
439 +        x -= y;
440 +        while (x < 0)
441 +                x += xres;
442 +        return((((x>>2)*yres + y) << 2) + (x & 3));
443   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines