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.11 by greg, Sun Dec 10 13:42:45 1989 UTC vs.
Revision 1.12 by greg, Mon Jan 8 13:38:01 1990 UTC

# Line 21 | Line 21 | static char SCCSid[] = "$SunId$ LBL";
21  
22   #include  "random.h"
23  
24 < VIEW  ourview = STDVIEW(512);           /* view parameters */
24 > VIEW  ourview = STDVIEW;                /* view parameters */
25 > int  hresolu = 512;                     /* horizontal resolution */
26 > int  vresolu = 512;                     /* vertical resolution */
27  
28   int  psample = 4;                       /* pixel sample size */
29   double  maxdiff = .05;                  /* max. difference for interpolation */
# Line 108 | Line 110 | char  *zfile, *oldfile;
110                  psample = MAXDIV;
111                                          /* allocate scanlines */
112          for (i = 0; i <= psample; i++) {
113 <                scanbar[i] = (COLOR *)malloc(ourview.hresolu*sizeof(COLOR));
113 >                scanbar[i] = (COLOR *)malloc(hresolu*sizeof(COLOR));
114                  if (scanbar[i] == NULL)
115                          goto memerr;
116          }
# Line 119 | Line 121 | char  *zfile, *oldfile;
121                          error(SYSTEM, errmsg);
122                  }
123                  for (i = 0; i <= psample; i++) {
124 <                        zbar[i] = (float *)malloc(ourview.hresolu*sizeof(float));
124 >                        zbar[i] = (float *)malloc(hresolu*sizeof(float));
125                          if (zbar[i] == NULL)
126                                  goto memerr;
127                  }
# Line 129 | Line 131 | char  *zfile, *oldfile;
131                          zbar[i] = NULL;
132          }
133                                          /* write out boundaries */
134 <        fputresolu(YMAJOR|YDECR, ourview.hresolu, ourview.vresolu, stdout);
134 >        fputresolu(YMAJOR|YDECR, hresolu, vresolu, stdout);
135                                          /* recover file and compute first */
136          i = salvage(oldfile);
137 <        if (zfp != NULL && fseek(zfp, (long)i*ourview.hresolu*sizeof(float), 0) == EOF)
137 >        if (zfp != NULL && fseek(zfp, (long)i*hresolu*sizeof(float), 0) == EOF)
138                  error(SYSTEM, "z file seek error in render");
139 <        ypos = ourview.vresolu-1 - i;
140 <        fillscanline(scanbar[0], zbar[0], ourview.hresolu, ypos, psample);
139 >        ypos = vresolu-1 - i;
140 >        fillscanline(scanbar[0], zbar[0], hresolu, ypos, psample);
141                                                  /* compute scanlines */
142          for (ypos -= psample; ypos >= 0; ypos -= psample) {
143          
144 <                pctdone = 100.0*(ourview.vresolu-ypos-psample)/ourview.vresolu;
144 >                pctdone = 100.0*(vresolu-ypos-psample)/vresolu;
145  
146                  colptr = scanbar[psample];              /* move base to top */
147                  scanbar[psample] = scanbar[0];
# Line 148 | Line 150 | char  *zfile, *oldfile;
150                  zbar[psample] = zbar[0];
151                  zbar[0] = zptr;
152                                                          /* fill base line */
153 <                fillscanline(scanbar[0], zbar[0], ourview.hresolu, ypos, psample);
153 >                fillscanline(scanbar[0], zbar[0], hresolu, ypos, psample);
154                                                          /* fill bar */
155 <                fillscanbar(scanbar, zbar, ourview.hresolu, ypos, psample);
155 >                fillscanbar(scanbar, zbar, hresolu, ypos, psample);
156                                                          /* write it out */
157                  for (i = psample; i > 0; i--) {
158 <                        if (zfp != NULL && fwrite(zbar[i],sizeof(float),ourview.hresolu,zfp) != ourview.hresolu)
158 >                        if (zfp != NULL && fwrite(zbar[i],sizeof(float),hresolu,zfp) != hresolu)
159                                  goto writerr;
160 <                        if (fwritescan(scanbar[i],ourview.hresolu,stdout) < 0)
160 >                        if (fwritescan(scanbar[i],hresolu,stdout) < 0)
161                                  goto writerr;
162                  }
163                  if (zfp != NULL && fflush(zfp) == EOF)
# Line 171 | Line 173 | char  *zfile, *oldfile;
173          zbar[psample] = zbar[0];
174          zbar[0] = zptr;
175          if (ypos > -psample) {
176 <                fillscanline(scanbar[-ypos], zbar[-ypos], ourview.hresolu,
177 <                                0, psample);
176 <                fillscanbar(scanbar-ypos, zbar-ypos, ourview.hresolu,
177 <                                0, psample+ypos);
176 >                fillscanline(scanbar[-ypos], zbar[-ypos], hresolu, 0, psample);
177 >                fillscanbar(scanbar-ypos, zbar-ypos, hresolu, 0, psample+ypos);
178          }
179          for (i = psample; i+ypos >= 0; i--) {
180 <                if (zfp != NULL && fwrite(zbar[i],sizeof(float),ourview.hresolu,zfp) != ourview.hresolu)
180 >                if (zfp != NULL && fwrite(zbar[i],sizeof(float),hresolu,zfp) != hresolu)
181                          goto writerr;
182 <                if (fwritescan(scanbar[i], ourview.hresolu, stdout) < 0)
182 >                if (fwritescan(scanbar[i], hresolu, stdout) < 0)
183                          goto writerr;
184          }
185                                                  /* clean up */
# Line 325 | Line 325 | int  x, y;                     /* pixel position */
325   {
326          static RAY  thisray;    /* our ray for this pixel */
327  
328 <        rayview(thisray.rorg, thisray.rdir, &ourview,
329 <                        x + pixjitter(), y + pixjitter());
328 >        viewray(thisray.rorg, thisray.rdir, &ourview,
329 >                        (x+pixjitter())/hresolu, (y+pixjitter())/vresolu);
330  
331          rayorigin(&thisray, NULL, PRIMARY, 1.0);
332          
# Line 364 | Line 364 | char  *oldfile;
364                  return(0);
365          }
366  
367 <        if (x != ourview.hresolu || y != ourview.vresolu) {
367 >        if (x != hresolu || y != vresolu) {
368                  sprintf(errmsg, "resolution mismatch in recover file \"%s\"",
369                                  oldfile);
370                  error(USER, errmsg);
371          }
372  
373 <        scanline = (COLR *)malloc(ourview.hresolu*sizeof(COLR));
373 >        scanline = (COLR *)malloc(hresolu*sizeof(COLR));
374          if (scanline == NULL)
375                  error(SYSTEM, "out of memory in salvage");
376 <        for (y = 0; y < ourview.vresolu; y++) {
377 <                if (freadcolrs(scanline, ourview.hresolu, fp) < 0)
376 >        for (y = 0; y < vresolu; y++) {
377 >                if (freadcolrs(scanline, hresolu, fp) < 0)
378                          break;
379 <                if (fwritecolrs(scanline, ourview.hresolu, stdout) < 0)
379 >                if (fwritecolrs(scanline, hresolu, stdout) < 0)
380                          goto writerr;
381          }
382          if (fflush(stdout) == EOF)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines