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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines