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.30 by greg, Mon Oct 21 13:30:43 1991 UTC vs.
Revision 1.33 by greg, Mon Nov 11 17:42:19 1991 UTC

# Line 18 | Line 18 | static char SCCSid[] = "$SunId$ LBL";
18  
19   #include  "rpaint.h"
20  
21 + #include  "resolu.h"
22 +
23   #include  <ctype.h>
24  
25   #define  CTRL(c)        ('c'-'@')
# Line 142 | Line 144 | char  *s;
144          if (sscanf(s, "%s", buf) == 1) {        /* get parameters from a file */
145                  copystruct(&nv, &stdview);
146                  if ((fname = getpath(buf, NULL, 0)) == NULL ||
147 <                                (success = viewfile(fname, &nv, 0, 0)) == -1) {
147 >                                (success = viewfile(fname, &nv, NULL)) == -1) {
148                          sprintf(errmsg, "cannot open \"%s\"", buf);
149                          error(COMMAND, errmsg);
150                          return;
# Line 321 | Line 323 | register union {int i; double d; COLOR C;}  *ptr;
323                          (*dev->comout)(buf);
324                          (*dev->comin)(buf, NULL);
325                          if (sscanf(buf, "%d", &i0) != 1)
326 <                                break;
326 >                                return(0);
327                  }
328                  ptr->i = i0;
329 <                break;
329 >                return(1);
330          case 'r':                       /* real */
331                  if (sscanf(str, "%lf", &d0) != 1) {
332                          (*dev->comout)(dsc);
# Line 332 | Line 334 | register union {int i; double d; COLOR C;}  *ptr;
334                          (*dev->comout)(buf);
335                          (*dev->comin)(buf, NULL);
336                          if (sscanf(buf, "%lf", &d0) != 1)
337 <                                break;
337 >                                return(0);
338                  }
339                  ptr->d = d0;
340 <                break;
340 >                return(1);
341          case 'b':                       /* boolean */
342                  if (sscanf(str, "%1s", buf) != 1) {
343                          (*dev->comout)(dsc);
# Line 344 | Line 346 | register union {int i; double d; COLOR C;}  *ptr;
346                          (*dev->comin)(buf, NULL);
347                          if (buf[0] == '\0' ||
348                                          index("yY+1tTnN-0fF", buf[0]) == NULL)
349 <                                break;
349 >                                return(0);
350                  }
351                  ptr->i = index("yY+1tT", buf[0]) != NULL;
352 <                break;
352 >                return(1);
353          case 'C':                       /* color */
354                  if (sscanf(str, "%lf %lf %lf", &d0, &d1, &d2) != 3) {
355                          (*dev->comout)(dsc);
# Line 358 | Line 360 | register union {int i; double d; COLOR C;}  *ptr;
360                          (*dev->comout)(buf);
361                          (*dev->comin)(buf, NULL);
362                          if (sscanf(buf, "%lf %lf %lf", &d0, &d1, &d2) != 3)
363 <                                break;
363 >                                return(0);
364                  }
365                  setcolor(ptr->C, d0, d1, d2);
366 <                break;
366 >                return(1);
367          }
368   }
369  
# Line 390 | Line 392 | register char  *s;
392          
393          if (s[0] == '\0') {
394                  (*dev->comout)(
395 <                        "aa ab ad ar as av b dc di dj dt i lr lw sp st: ");
395 >                        "aa ab ad ar as av b dc di dj ds dt i lr lw sp st: ");
396                  (*dev->comin)(buf, NULL);
397                  s = buf;
398          }
# Line 453 | Line 455 | register char  *s;
455                          getparam(s+2, "ambient bounces", 'i', &ambounce);
456                          break;
457                  case 'r':
458 <                        getparam(s+2, "ambient resolution", 'i', &ambres);
459 <                        minarad = ambres > 0 ? thescene.cusize/ambres : 0.0;
458 >                        if (getparam(s+2, "ambient resolution", 'i', &ambres))
459 >                                minarad = ambres > 0 ?
460 >                                                thescene.cusize/ambres : 0.0;
461                          break;
462                  default:
463                          goto badparam;
# Line 463 | Line 466 | register char  *s;
466          case 's':                       /* sample */
467                  switch (s[1]) {
468                  case 'p':                       /* pixel */
469 <                        getparam(s+2, "sample pixel", 'i', &psample);
470 <                        pdepth = 0;
469 >                        if (getparam(s+2, "sample pixel", 'i', &psample))
470 >                                pdepth = 0;
471                          break;
472                  case 't':                       /* threshold */
473 <                        getparam(s+2, "sample threshold", 'r', &maxdiff);
474 <                        pdepth = 0;
473 >                        if (getparam(s+2, "sample threshold", 'r', &maxdiff))
474 >                                pdepth = 0;
475                          break;
476                  default:
477                          goto badparam;
# Line 535 | Line 538 | char  *s;
538                          (*dev->comout)(buf);
539                  }
540                  (*dev->comin)(buf, NULL);
541 <                sprintf(buf, "with value (%.6g %.6g %.6g)",
541 >                sprintf(buf, "value (%.5g %.5g %.5g) (%.1fL)",
542                                  colval(thisray.rcol,RED),
543                                  colval(thisray.rcol,GRN),
544 <                                colval(thisray.rcol,BLU));
544 >                                colval(thisray.rcol,BLU),
545 >                                luminance(thisray.rcol));
546                  (*dev->comout)(buf);
547          }
548          (*dev->comin)(buf, NULL);
# Line 581 | Line 585 | char  *s;
585                  fputaspect(dev->pixaspect, fp);
586          fputformat(COLRFMT, fp);
587          putc('\n', fp);
588 <        fputresolu(YMAJOR|YDECR, hresolu, vresolu, fp);
588 >        fprtresolu(hresolu, vresolu, fp);
589  
590          scanline = (COLR *)malloc(hresolu*sizeof(COLR));
591          if (scanline == NULL) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines