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

Comparing ray/src/rt/rv2.c (file contents):
Revision 1.11 by greg, Wed Sep 13 13:40:13 1989 UTC vs.
Revision 1.24 by greg, Thu Jul 18 16:37:59 1991 UTC

# Line 28 | Line 28 | extern char  *progname;
28   getframe(s)                             /* get a new frame */
29   char  *s;
30   {
31 <        int  x0, y0, x1, y1;
32 <
33 <        if (!strcmp("all", s)) {
34 <                pframe.l = pframe.d = 0;
35 <                pframe.r = ourview.hresolu;
36 <                pframe.u = ourview.vresolu;
37 <                pdepth = 0;
31 >        if (getrect(s, &pframe) < 0)
32                  return;
39        }
40        if (sscanf(s, "%d %d %d %d", &x0, &y0, &x1, &y1) != 4) {
41                if (dev->getcur == NULL)
42                        return;
43                (*dev->comout)("Pick first corner\n");
44                if ((*dev->getcur)(&x0, &y0) == ABORT)
45                        return;
46                (*dev->comout)("Pick second corner\n");
47                if ((*dev->getcur)(&x1, &y1) == ABORT)
48                        return;
49        }
50        if (x0 < x1) {
51                pframe.l = x0;
52                pframe.r = x1;
53        } else {
54                pframe.l = x1;
55                pframe.r = x0;
56        }
57        if (y0 < y1) {
58                pframe.d = y0;
59                pframe.u = y1;
60        } else {
61                pframe.d = y1;
62                pframe.u = y0;
63        }
64        if (pframe.l < 0) pframe.l = 0;
65        if (pframe.d < 0) pframe.d = 0;
66        if (pframe.r > ourview.hresolu) pframe.r = ourview.hresolu;
67        if (pframe.u > ourview.vresolu) pframe.u = ourview.vresolu;
68        if (pframe.l > pframe.r) pframe.l = pframe.r;
69        if (pframe.d > pframe.u) pframe.d = pframe.u;
33          pdepth = 0;
34   }
35  
36  
37 + getrepaint(s)                           /* get area and repaint */
38 + char  *s;
39 + {
40 +        RECT  box;
41 +
42 +        if (getrect(s, &box) < 0)
43 +                return;
44 +        paintrect(&ptrunk, 0, 0, hresolu, vresolu, &box);
45 + }
46 +
47 +
48   getview(s)                              /* get/show view parameters */
49   char  *s;
50   {
# Line 89 | Line 63 | char  *s;
63                  }
64                  fputs(progname, fp);
65                  fprintview(&ourview, fp);
66 +                fputs(sskip(s), fp);
67                  fputs("\n", fp);
68                  fclose(fp);
69                  return;
70          }
71          sprintf(buf, "view type (%c): ", ourview.type);
72          (*dev->comout)(buf);
73 <        (*dev->comin)(buf);
73 >        (*dev->comin)(buf, NULL);
74          if (buf[0] == CTRL(C)) return;
75          if (buf[0] && buf[0] != ourview.type) {
76                  nv.type = buf[0];
# Line 105 | Line 80 | char  *s;
80          sprintf(buf, "view point (%.6g %.6g %.6g): ",
81                          ourview.vp[0], ourview.vp[1], ourview.vp[2]);
82          (*dev->comout)(buf);
83 <        (*dev->comin)(buf);
83 >        (*dev->comin)(buf, NULL);
84          if (buf[0] == CTRL(C)) return;
85          if (sscanf(buf, "%lf %lf %lf", &nv.vp[0], &nv.vp[1], &nv.vp[2]) == 3)
86                  change++;
# Line 114 | Line 89 | char  *s;
89          sprintf(buf, "view direction (%.6g %.6g %.6g): ",
90                          ourview.vdir[0], ourview.vdir[1], ourview.vdir[2]);
91          (*dev->comout)(buf);
92 <        (*dev->comin)(buf);
92 >        (*dev->comin)(buf, NULL);
93          if (buf[0] == CTRL(C)) return;
94          if (sscanf(buf,"%lf %lf %lf",&nv.vdir[0],&nv.vdir[1],&nv.vdir[2]) == 3)
95                  change++;
# Line 123 | Line 98 | char  *s;
98          sprintf(buf, "view up (%.6g %.6g %.6g): ",
99                          ourview.vup[0], ourview.vup[1], ourview.vup[2]);
100          (*dev->comout)(buf);
101 <        (*dev->comin)(buf);
101 >        (*dev->comin)(buf, NULL);
102          if (buf[0] == CTRL(C)) return;
103          if (sscanf(buf,"%lf %lf %lf",&nv.vup[0],&nv.vup[1],&nv.vup[2]) == 3)
104                  change++;
# Line 132 | Line 107 | char  *s;
107          sprintf(buf, "view horiz and vert size (%.6g %.6g): ",
108                          ourview.horiz, ourview.vert);
109          (*dev->comout)(buf);
110 <        (*dev->comin)(buf);
110 >        (*dev->comin)(buf, NULL);
111          if (buf[0] == CTRL(C)) return;
112          if (sscanf(buf, "%lf %lf", &nv.horiz, &nv.vert) == 2)
113                  change++;
114          else {
115                  nv.horiz = ourview.horiz; nv.vert = ourview.vert;
116          }
117 <        sprintf(buf, "x and y resolution (%d %d): ",
118 <                        ourview.hresolu, ourview.vresolu);
117 >        sprintf(buf, "view shift and lift (%.6g %.6g): ",
118 >                        ourview.hoff, ourview.voff);
119          (*dev->comout)(buf);
120 <        (*dev->comin)(buf);
120 >        (*dev->comin)(buf, NULL);
121          if (buf[0] == CTRL(C)) return;
122 <        if (sscanf(buf, "%d %d", &nv.hresolu, &nv.vresolu) == 2)
122 >        if (sscanf(buf, "%lf %lf", &nv.hoff, &nv.voff) == 2)
123                  change++;
124          else {
125 <                nv.hresolu = ourview.hresolu; nv.vresolu = ourview.vresolu;
125 >                nv.hoff = ourview.hoff; nv.voff = ourview.voff;
126          }
127          if (change)
128                  newview(&nv);
# Line 163 | Line 138 | char  *s;
138          VIEW  nv;
139  
140          if (sscanf(s, "%s", buf) == 1) {        /* get parameters from a file */
141 <                bcopy(&stdview, &nv, sizeof(VIEW));
141 >                copystruct(&nv, &stdview);
142                  if ((fname = getpath(buf, NULL, 0)) == NULL ||
143 <                                (success = viewfile(fname, &nv)) == -1) {
143 >                                (success = viewfile(fname, &nv, 0, 0)) == -1) {
144                          sprintf(errmsg, "cannot open \"%s\"", buf);
145                          error(COMMAND, errmsg);
146                          return;
# Line 176 | Line 151 | char  *s;
151                          newview(&nv);
152                  return;
153          }
154 <        if (oldview.hresolu == 0) {     /* no old view! */
154 >        if (oldview.type == 0) {        /* no old view! */
155                  error(COMMAND, "no previous view");
156                  return;
157          }
158 <        bcopy(&ourview, &nv, sizeof(VIEW));
159 <        bcopy(&oldview, &ourview, sizeof(VIEW));
160 <        bcopy(&nv, &oldview, sizeof(VIEW));
158 >        copystruct(&nv, &ourview);
159 >        copystruct(&ourview, &oldview);
160 >        copystruct(&oldview, &nv);
161          newimage();
162   }
163  
164  
190 getinterest(s, direc, vec, mp)          /* get area of interest */
191 char  *s;
192 int  direc;
193 FVECT  vec;
194 double  *mp;
195 {
196        int  x, y;
197        RAY  thisray;
198        register int  i;
199
200        if (sscanf(s, "%lf", mp) != 1)
201                *mp = 1.0;
202        else if (*mp < -FTINY)          /* negative zoom is reduction */
203                *mp = -1.0 / *mp;
204        else if (*mp <= FTINY) {        /* too small */
205                error(COMMAND, "illegal magnification");
206                return(-1);
207        }
208        if (sscanf(s, "%*lf %lf %lf %lf", &vec[0], &vec[1], &vec[2]) != 3) {
209                if (dev->getcur == NULL)
210                        return(-1);
211                (*dev->comout)("Pick view center\n");
212                if ((*dev->getcur)(&x, &y) == ABORT)
213                        return(-1);
214                rayview(thisray.rorg, thisray.rdir, &ourview, x+.5, y+.5);
215                if (!direc || ourview.type == VT_PAR) {
216                        rayorigin(&thisray, NULL, PRIMARY, 1.0);
217                        if (!localhit(&thisray, &thescene)) {
218                                error(COMMAND, "not a local object");
219                                return(-1);
220                        }
221                }
222                if (direc)
223                        if (ourview.type == VT_PAR)
224                                for (i = 0; i < 3; i++)
225                                        vec[i] = thisray.rop[i] - ourview.vp[i];
226                        else
227                                VCOPY(vec, thisray.rdir);
228                else
229                        VCOPY(vec, thisray.rop);
230        } else if (direc)
231                        for (i = 0; i < 3; i++)
232                                vec[i] -= ourview.vp[i];
233        return(0);
234 }
235
236
165   getaim(s)                               /* aim camera */
166   char  *s;
167   {
# Line 243 | Line 171 | char  *s;
171  
172          if (getinterest(s, 1, nv.vdir, &zfact) < 0)
173                  return;
174 +        nv.type = ourview.type;
175          VCOPY(nv.vp, ourview.vp);
176          VCOPY(nv.vup, ourview.vup);
177 <        nv.hresolu = ourview.hresolu; nv.vresolu = ourview.vresolu;
178 <        if ((nv.type = ourview.type) == VT_PAR) {
179 <                nv.horiz = ourview.horiz / zfact;
251 <                nv.vert = ourview.vert / zfact;
252 <        } else {
253 <                nv.horiz = atan(tan(ourview.horiz*(PI/180./2.))/zfact) /
254 <                                (PI/180./2.);
255 <                nv.vert = atan(tan(ourview.vert*(PI/180./2.))/zfact) /
256 <                                (PI/180./2.);
257 <        }
177 >        nv.hoff = ourview.hoff; nv.voff = ourview.voff;
178 >        nv.horiz = ourview.horiz; nv.vert = ourview.vert;
179 >        zoomview(&nv, zfact);
180          newview(&nv);
181   }
182  
# Line 284 | Line 206 | char  *s;
206                  error(COMMAND, "missing angle");
207                  return;
208          }
209 +        nv.type = ourview.type;
210          VCOPY(nv.vp, ourview.vp);
211          VCOPY(nv.vup, ourview.vup);
212 <        nv.hresolu = ourview.hresolu; nv.vresolu = ourview.vresolu;
212 >        nv.hoff = ourview.hoff; nv.voff = ourview.voff;
213          spinvector(nv.vdir, ourview.vdir, ourview.vup, angle*(PI/180.));
214          if (elev != 0.0) {
215                  fcross(v1, nv.vdir, ourview.vup);
216                  normalize(v1);
217                  spinvector(nv.vdir, nv.vdir, v1, elev*(PI/180.));
218          }
219 <        if ((nv.type = ourview.type) == VT_PAR) {
220 <                nv.horiz = ourview.horiz / zfact;
298 <                nv.vert = ourview.vert / zfact;
299 <        } else {
300 <                nv.horiz = atan(tan(ourview.horiz*(PI/180./2.))/zfact) /
301 <                                (PI/180./2.);
302 <                nv.vert = atan(tan(ourview.vert*(PI/180./2.))/zfact) /
303 <                                (PI/180./2.);
304 <        }
219 >        nv.horiz = ourview.horiz; nv.vert = ourview.vert;
220 >        zoomview(&nv, zfact);
221          newview(&nv);
222   }
223  
# Line 343 | Line 259 | char  *s;
259                  if ((*dev->getcur)(&x, &y) == ABORT)
260                          return;
261                  r.l = r.d = 0;
262 <                r.r = ourview.hresolu; r.u = ourview.vresolu;
262 >                r.r = hresolu; r.u = vresolu;
263                  p = findrect(x, y, &ptrunk, &r, -1);
264                  e = 1.0;
265          } else {
# Line 355 | Line 271 | char  *s;
271                          if (*cp == '\0') {      /* interactive */
272                                  sprintf(buf, "exposure (%lf): ", exposure);
273                                  (*dev->comout)(buf);
274 <                                (*dev->comin)(buf);
274 >                                (*dev->comin)(buf, NULL);
275                                  for (cp = buf; isspace(*cp); cp++)
276                                          ;
277                                  if (*cp == '\0')
# Line 385 | Line 301 | char  *s;
301   }
302  
303  
304 + getparam(str, dsc, typ, ptr)            /* get variable from user */
305 + char  *str, *dsc;
306 + int  typ;
307 + register union {int i; double d; COLOR C;}  *ptr;
308 + {
309 +        int  i0;
310 +        double  d0, d1, d2;
311 +        char  buf[48];
312 +
313 +        switch (typ) {
314 +        case 'i':                       /* integer */
315 +                if (sscanf(str, "%d", &i0) != 1) {
316 +                        (*dev->comout)(dsc);
317 +                        sprintf(buf, " (%d): ", ptr->i);
318 +                        (*dev->comout)(buf);
319 +                        (*dev->comin)(buf, NULL);
320 +                        if (sscanf(buf, "%d", &i0) != 1)
321 +                                break;
322 +                }
323 +                ptr->i = i0;
324 +                break;
325 +        case 'r':                       /* real */
326 +                if (sscanf(str, "%lf", &d0) != 1) {
327 +                        (*dev->comout)(dsc);
328 +                        sprintf(buf, " (%.6g): ", ptr->d);
329 +                        (*dev->comout)(buf);
330 +                        (*dev->comin)(buf, NULL);
331 +                        if (sscanf(buf, "%lf", &d0) != 1)
332 +                                break;
333 +                }
334 +                ptr->d = d0;
335 +                break;
336 +        case 'b':                       /* boolean */
337 +                if (sscanf(str, "%1s", buf) != 1) {
338 +                        (*dev->comout)(dsc);
339 +                        sprintf(buf, " (%c): ", ptr->i ? 'y' : 'n');
340 +                        (*dev->comout)(buf);
341 +                        (*dev->comin)(buf, NULL);
342 +                }
343 +                ptr->i = tolower(buf[0]) == 'y';
344 +                break;
345 +        case 'C':                       /* color */
346 +                if (sscanf(str, "%lf %lf %lf", &d0, &d1, &d2) != 3) {
347 +                        (*dev->comout)(dsc);
348 +                        sprintf(buf, " (%.6g %.6g %.6g): ",
349 +                                        colval(ptr->C,RED),
350 +                                        colval(ptr->C,GRN),
351 +                                        colval(ptr->C,BLU));
352 +                        (*dev->comout)(buf);
353 +                        (*dev->comin)(buf, NULL);
354 +                        if (sscanf(buf, "%lf %lf %lf", &d0, &d1, &d2) != 3)
355 +                                break;
356 +                }
357 +                setcolor(ptr->C, d0, d1, d2);
358 +                break;
359 +        }
360 + }
361 +
362 +
363   setparam(s)                             /* get/set program parameter */
364   register char  *s;
365   {
# Line 402 | Line 377 | register char  *s;
377          extern int  ambdiv;
378          extern int  ambssamp;
379          extern int  ambounce;
380 <        int  i0;
381 <        double  d0, d1, d2;
380 >        extern int  directinvis;
381 >        extern int  do_irrad;
382          char  buf[128];
383          
384          if (s[0] == '\0') {
385 <                (*dev->comout)("aa ab ad ar as av dc dj dt lr lw sp st: ");
386 <                (*dev->comin)(buf);
385 >                (*dev->comout)(
386 >                        "aa ab ad ar as av b dc di dj dt i lr lw sp st: ");
387 >                (*dev->comin)(buf, NULL);
388                  s = buf;
389          }
390          switch (s[0]) {
391          case 'l':                       /* limit */
392                  switch (s[1]) {
393                  case 'w':                       /* weight */
394 <                        if (sscanf(s+2, "%lf", &d0) != 1) {
419 <                                sprintf(buf, "limit weight (%.6g): ",
420 <                                                minweight);
421 <                                (*dev->comout)(buf);
422 <                                (*dev->comin)(buf);
423 <                                if (sscanf(buf, "%lf", &d0) != 1)
424 <                                        break;
425 <                        }
426 <                        minweight = d0;
394 >                        getparam(s+2, "limit weight", 'r', &minweight);
395                          break;
396                  case 'r':                       /* reflection */
397 <                        if (sscanf(s+2, "%d", &i0) != 1) {
430 <                                sprintf(buf, "limit reflection (%d): ",
431 <                                                maxdepth);
432 <                                (*dev->comout)(buf);
433 <                                (*dev->comin)(buf);
434 <                                if (sscanf(buf, "%d", &i0) != 1)
435 <                                        break;
436 <                        }
437 <                        maxdepth = i0;
397 >                        getparam(s+2, "limit reflection", 'i', &maxdepth);
398                          break;
399                  default:
400                          goto badparam;
# Line 443 | Line 403 | register char  *s;
403          case 'd':                       /* direct */
404                  switch (s[1]) {
405                  case 'j':                       /* jitter */
406 <                        if (sscanf(s+2, "%lf", &d0) != 1) {
447 <                                sprintf(buf, "direct jitter (%.6g): ",
448 <                                                dstrsrc);
449 <                                (*dev->comout)(buf);
450 <                                (*dev->comin)(buf);
451 <                                if (sscanf(buf, "%lf", &d0) != 1)
452 <                                        break;
453 <                        }
454 <                        dstrsrc = d0;
406 >                        getparam(s+2, "direct jitter", 'r', &dstrsrc);
407                          break;
408                  case 'c':                       /* certainty */
409 <                        if (sscanf(s+2, "%lf", &d0) != 1) {
458 <                                sprintf(buf, "direct certainty (%.6g): ",
459 <                                                shadcert);
460 <                                (*dev->comout)(buf);
461 <                                (*dev->comin)(buf);
462 <                                if (sscanf(buf, "%lf", &d0) != 1)
463 <                                        break;
464 <                        }
465 <                        shadcert = d0;
409 >                        getparam(s+2, "direct certainty", 'r', &shadcert);
410                          break;
411                  case 't':                       /* threshold */
412 <                        if (sscanf(s+2, "%lf", &d0) != 1) {
469 <                                sprintf(buf, "direct threshold (%.6g): ",
470 <                                                shadthresh);
471 <                                (*dev->comout)(buf);
472 <                                (*dev->comin)(buf);
473 <                                if (sscanf(buf, "%lf", &d0) != 1)
474 <                                        break;
475 <                        }
476 <                        shadthresh = d0;
412 >                        getparam(s+2, "direct threshold", 'r', &shadthresh);
413                          break;
414 +                case 'i':                       /* invisibility */
415 +                        getparam(s+2, "direct invisibility",
416 +                                        'b', &directinvis);
417 +                        break;
418                  default:
419                          goto badparam;
420                  }
421                  break;
422 +        case 'b':                       /* black and white */
423 +                getparam(s+1, "black and white", 'b', &greyscale);
424 +                break;
425 +        case 'i':                       /* irradiance */
426 +                getparam(s+1, "irradiance", 'b', &do_irrad);
427 +                break;
428          case 'a':                       /* ambient */
429                  switch (s[1]) {
430                  case 'v':                       /* value */
431 <                        if (sscanf(s+2, "%lf %lf %lf", &d0, &d1, &d2) != 3) {
486 <                                sprintf(buf,
487 <                                        "ambient value (%.6g %.6g %.6g): ",
488 <                                                colval(ambval,RED),
489 <                                                colval(ambval,GRN),
490 <                                                colval(ambval,BLU));
491 <                                (*dev->comout)(buf);
492 <                                (*dev->comin)(buf);
493 <                                if (sscanf(buf, "%lf %lf %lf",
494 <                                                &d0, &d1, &d2) != 3)
495 <                                        break;
496 <                        }
497 <                        setcolor(ambval, d0, d1, d2);
431 >                        getparam(s+2, "ambient value", 'C', ambval);
432                          break;
433                  case 'a':                       /* accuracy */
434 <                        if (sscanf(s+2, "%lf", &d0) != 1) {
501 <                                sprintf(buf, "ambient accuracy (%.6g): ",
502 <                                                ambacc);
503 <                                (*dev->comout)(buf);
504 <                                (*dev->comin)(buf);
505 <                                if (sscanf(buf, "%lf", &d0) != 1)
506 <                                        break;
507 <                        }
508 <                        ambacc = d0;
434 >                        getparam(s+2, "ambient accuracy", 'r', &ambacc);
435                          break;
436                  case 'd':                       /* divisions */
437 <                        if (sscanf(s+2, "%d", &i0) != 1) {
512 <                                sprintf(buf, "ambient divisions (%d): ",
513 <                                                ambdiv);
514 <                                (*dev->comout)(buf);
515 <                                (*dev->comin)(buf);
516 <                                if (sscanf(buf, "%d", &i0) != 1)
517 <                                        break;
518 <                        }
519 <                        ambdiv = i0;
437 >                        getparam(s+2, "ambient divisions", 'i', &ambdiv);
438                          break;
439                  case 's':                       /* samples */
440 <                        if (sscanf(s+2, "%d", &i0) != 1) {
523 <                                sprintf(buf, "ambient super-samples (%d): ",
524 <                                                ambssamp);
525 <                                (*dev->comout)(buf);
526 <                                (*dev->comin)(buf);
527 <                                if (sscanf(buf, "%d", &i0) != 1)
528 <                                        break;
529 <                        }
530 <                        ambssamp = i0;
440 >                        getparam(s+2, "ambient super-samples", 'i', &ambssamp);
441                          break;
442                  case 'b':                       /* bounces */
443 <                        if (sscanf(s+2, "%d", &i0) != 1) {
534 <                                sprintf(buf, "ambient bounces (%d): ",
535 <                                                ambounce);
536 <                                (*dev->comout)(buf);
537 <                                (*dev->comin)(buf);
538 <                                if (sscanf(buf, "%d", &i0) != 1)
539 <                                        break;
540 <                        }
541 <                        ambounce = i0;
443 >                        getparam(s+2, "ambient bounces", 'i', &ambounce);
444                          break;
445                  case 'r':
446 <                        if (sscanf(s+2, "%d", &i0) != 1) {
545 <                                sprintf(buf, "ambient resolution (%d): ",
546 <                                                ambres);
547 <                                (*dev->comout)(buf);
548 <                                (*dev->comin)(buf);
549 <                                if (sscanf(buf, "%d", &i0) != 1)
550 <                                        break;
551 <                        }
552 <                        ambres = i0;
446 >                        getparam(s+2, "ambient resolution", 'i', &ambres);
447                          minarad = ambres > 0 ? thescene.cusize/ambres : 0.0;
448                          break;
449                  default:
# Line 559 | Line 453 | register char  *s;
453          case 's':                       /* sample */
454                  switch (s[1]) {
455                  case 'p':                       /* pixel */
456 <                        if (sscanf(s+2, "%d", &i0) != 1) {
563 <                                sprintf(buf, "sample pixel (%d): ", psample);
564 <                                (*dev->comout)(buf);
565 <                                (*dev->comin)(buf);
566 <                                if (sscanf(buf, "%d", &i0) != 1)
567 <                                        break;
568 <                        }
569 <                        psample = i0;
456 >                        getparam(s+2, "sample pixel", 'i', &psample);
457                          pdepth = 0;
458                          break;
459                  case 't':                       /* threshold */
460 <                        if (sscanf(s+2, "%lf", &d0) != 1) {
574 <                                sprintf(buf, "sample threshold (%.6g): ",
575 <                                                maxdiff);
576 <                                (*dev->comout)(buf);
577 <                                (*dev->comin)(buf);
578 <                                if (sscanf(buf, "%lf", &d0) != 1)
579 <                                        break;
580 <                        }
581 <                        maxdiff = d0;
460 >                        getparam(s+2, "sample threshold", 'r', &maxdiff);
461                          pdepth = 0;
462                          break;
463                  default:
# Line 613 | Line 492 | char  *s;
492                  if ((*dev->getcur)(&x, &y) == ABORT)
493                          return;
494  
495 <                rayview(thisray.rorg, thisray.rdir, &ourview, x+.5, y+.5);
496 <                
495 >                if (viewray(thisray.rorg, thisray.rdir, &ourview,
496 >                                (x+.5)/hresolu, (y+.5)/vresolu) < 0) {
497 >                        error(COMMAND, "not on image");
498 >                        return;
499 >                }
500 >
501          } else if (normalize(thisray.rdir) == 0.0) {
502                  error(COMMAND, "zero ray direction");
503                  return;
# Line 632 | Line 515 | char  *s;
515                                  ofun[thisray.ro->otype].funame,
516                                  thisray.ro->oname);
517                  (*dev->comout)(buf);
518 <                (*dev->comin)(buf);
518 >                (*dev->comin)(buf, NULL);
519                  if (thisray.rot >= FHUGE)
520                          (*dev->comout)("at infinity");
521                  else {
# Line 640 | Line 523 | char  *s;
523                                          thisray.rop[1], thisray.rop[2]);
524                          (*dev->comout)(buf);
525                  }
526 <                (*dev->comin)(buf);
526 >                (*dev->comin)(buf, NULL);
527                  sprintf(buf, "with value (%.6g %.6g %.6g)",
528                                  colval(thisray.rcol,RED),
529                                  colval(thisray.rcol,GRN),
530                                  colval(thisray.rcol,BLU));
531                  (*dev->comout)(buf);
532          }
533 <        (*dev->comin)(buf);
533 >        (*dev->comin)(buf, NULL);
534   }
535  
536  
# Line 678 | Line 561 | char  *s;
561          fprintview(&ourview, fp);
562          putc('\n', fp);
563          if (exposure != 1.0)
564 <                fprintf(fp, "EXPOSURE=%e\n", exposure);
564 >                fputexpos(exposure, fp);
565 >        if (dev->pixaspect != 1.0)
566 >                fputaspect(dev->pixaspect, fp);
567 >        fputformat(COLRFMT, fp);
568          putc('\n', fp);
569 <        fputresolu(YMAJOR|YDECR, ourview.hresolu, ourview.vresolu, fp);
569 >        fputresolu(YMAJOR|YDECR, hresolu, vresolu, fp);
570  
571 <        scanline = (COLR *)malloc(ourview.hresolu*sizeof(COLR));
571 >        scanline = (COLR *)malloc(hresolu*sizeof(COLR));
572          if (scanline == NULL)
573                  error(SYSTEM, "out of memory in writepict");
574 <        for (y = ourview.vresolu-1; y >= 0; y--) {
575 <                getpictcolrs(y, scanline, &ptrunk,
576 <                                ourview.hresolu, ourview.vresolu);
691 <                if (fwritecolrs(scanline, ourview.hresolu, fp) < 0)
574 >        for (y = vresolu-1; y >= 0; y--) {
575 >                getpictcolrs(y, scanline, &ptrunk, hresolu, vresolu);
576 >                if (fwritecolrs(scanline, hresolu, fp) < 0)
577                          break;
578          }
579          if (fclose(fp) < 0)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines