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

Comparing ray/src/hd/rhpict.c (file contents):
Revision 3.2 by gwlarson, Fri Mar 5 17:02:41 1999 UTC vs.
Revision 3.4 by gwlarson, Tue Mar 9 10:55:24 1999 UTC

# Line 50 | Line 50 | char   *argv[];
50                  case 'p':                       /* pixel aspect/exposure */
51                          if (badarg(argc-i-1,argv+i+1,"f"))
52                                  goto userr;
53 <                        if (argv[i][1] == 'a')
53 >                        if (argv[i][2] == 'a')
54                                  pixaspect = atof(argv[++i]);
55 <                        else if (argv[i][1] == 'e') {
55 >                        else if (argv[i][2] == 'e') {
56                                  expval = atof(argv[++i]);
57                                  if (argv[i][0] == '-' | argv[i][0] == '+')
58                                          expval = pow(2., expval);
# Line 80 | Line 80 | char   *argv[];
80                          seqstart = atoi(argv[++i]);
81                          break;
82                  case 'v':                       /* view file */
83 <                        if (argv[i][1]!='f' || badarg(argc-i-1,argv+i+1,"s"))
83 >                        if (argv[i][2]!='f' || badarg(argc-i-1,argv+i+1,"s"))
84                                  goto userr;
85                          rval = viewfile(argv[++i], &myview, NULL);
86                          if (rval < 0) {
# Line 98 | Line 98 | char   *argv[];
98                  }
99          }
100                                                  /* open holodeck file */
101 <        if (i >= argc)
101 >        if (i != argc-1)
102                  goto userr;
103 <        hdkfile = argv[i++];
103 >        hdkfile = argv[i];
104          initialize();
105                                                  /* render picture(s) */
106          if (seqstart <= 0)
# Line 145 | Line 145 | int    fn;
145                  sprintf(errmsg, "error writing frame %d", fn);
146                  error(SYSTEM, errmsg);
147          }
148 + #ifdef DEBUG
149          if (blist.nb > 0 & rval > 0) {
150 <                sprintf(errmsg, "%.1f%% unrendered pixels in frame %d",
151 <                                100.*rval/(hres*vres), fn);
150 >                sprintf(errmsg, "%d unrendered pixels in frame %d (%.1f%%)",
151 >                                rval, fn, 100.*rval/(hres*vres));
152                  error(WARNING, errmsg);
153          }
154 + #endif
155   }
156  
157  
# Line 218 | Line 220 | int    fn;
220   int
221   endpicture()                    /* finish and write out pixels */
222   {
223 <        int     nunrend = 0;
224 <        int     v;
223 >        int     lastr = -1, nunrend = 0;
224 >        int4    lastp, lastrp;
225 >        register int4   p;
226          register double d;
224        register int    p;
227                                  /* compute final pixel values */
228          for (p = hres*vres; p--; ) {
229                  if (myweight[p] <= FTINY) {
230 +                        if (lastr >= 0)
231 +                                if (p/hres == lastp/hres)
232 +                                        copycolor(mypixel[p], mypixel[lastp]);
233 +                                else
234 +                                        copycolor(mypixel[p], mypixel[lastrp]);
235                          nunrend++;
236                          continue;
237                  }
238                  d = expval/myweight[p];
239                  scalecolor(mypixel[p], d);
240 +                if ((lastp=p)/hres != lastr)
241 +                        lastr = (lastrp=p)/hres;
242          }
243                                  /* write each scanline */
244 <        for (v = vres; v--; )
245 <                if (fwritescan(mypixel+v*hres, hres, stdout) < 0)
244 >        for (p = vres; p--; )
245 >                if (fwritescan(mypixel+p*hres, hres, stdout) < 0)
246                          return(-1);
247          if (fflush(stdout) == EOF)
248                  return(-1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines