--- ray/src/rt/rv2.c 1991/10/21 13:30:43 1.30 +++ ray/src/rt/rv2.c 1991/12/19 14:54:55 2.3 @@ -18,6 +18,8 @@ static char SCCSid[] = "$SunId$ LBL"; #include "rpaint.h" +#include "resolu.h" + #include #define CTRL(c) ('c'-'@') @@ -142,7 +144,7 @@ char *s; if (sscanf(s, "%s", buf) == 1) { /* get parameters from a file */ copystruct(&nv, &stdview); if ((fname = getpath(buf, NULL, 0)) == NULL || - (success = viewfile(fname, &nv, 0, 0)) == -1) { + (success = viewfile(fname, &nv, NULL)) == -1) { sprintf(errmsg, "cannot open \"%s\"", buf); error(COMMAND, errmsg); return; @@ -244,7 +246,6 @@ register char *s; getexposure(s) /* get new exposure */ char *s; { - double atof(), pow(), fabs(); char buf[128]; register char *cp; register PNODE *p; @@ -321,10 +322,10 @@ register union {int i; double d; COLOR C;} *ptr; (*dev->comout)(buf); (*dev->comin)(buf, NULL); if (sscanf(buf, "%d", &i0) != 1) - break; + return(0); } ptr->i = i0; - break; + return(1); case 'r': /* real */ if (sscanf(str, "%lf", &d0) != 1) { (*dev->comout)(dsc); @@ -332,22 +333,22 @@ register union {int i; double d; COLOR C;} *ptr; (*dev->comout)(buf); (*dev->comin)(buf, NULL); if (sscanf(buf, "%lf", &d0) != 1) - break; + return(0); } ptr->d = d0; - break; + return(1); case 'b': /* boolean */ if (sscanf(str, "%1s", buf) != 1) { (*dev->comout)(dsc); - sprintf(buf, " (%c): ", ptr->i ? 'y' : 'n'); + sprintf(buf, "? (%c): ", ptr->i ? 'y' : 'n'); (*dev->comout)(buf); (*dev->comin)(buf, NULL); if (buf[0] == '\0' || index("yY+1tTnN-0fF", buf[0]) == NULL) - break; + return(0); } ptr->i = index("yY+1tT", buf[0]) != NULL; - break; + return(1); case 'C': /* color */ if (sscanf(str, "%lf %lf %lf", &d0, &d1, &d2) != 3) { (*dev->comout)(dsc); @@ -358,10 +359,10 @@ register union {int i; double d; COLOR C;} *ptr; (*dev->comout)(buf); (*dev->comin)(buf, NULL); if (sscanf(buf, "%lf %lf %lf", &d0, &d1, &d2) != 3) - break; + return(0); } setcolor(ptr->C, d0, d1, d2); - break; + return(1); } } @@ -390,7 +391,7 @@ register char *s; if (s[0] == '\0') { (*dev->comout)( - "aa ab ad ar as av b dc di dj dt i lr lw sp st: "); + "aa ab ad ar as av b dc di dj ds dt i lr lw sp st: "); (*dev->comin)(buf, NULL); s = buf; } @@ -453,8 +454,9 @@ register char *s; getparam(s+2, "ambient bounces", 'i', &ambounce); break; case 'r': - getparam(s+2, "ambient resolution", 'i', &ambres); - minarad = ambres > 0 ? thescene.cusize/ambres : 0.0; + if (getparam(s+2, "ambient resolution", 'i', &ambres)) + minarad = ambres > 0 ? + thescene.cusize/ambres : 0.0; break; default: goto badparam; @@ -463,12 +465,12 @@ register char *s; case 's': /* sample */ switch (s[1]) { case 'p': /* pixel */ - getparam(s+2, "sample pixel", 'i', &psample); - pdepth = 0; + if (getparam(s+2, "sample pixel", 'i', &psample)) + pdepth = 0; break; case 't': /* threshold */ - getparam(s+2, "sample threshold", 'r', &maxdiff); - pdepth = 0; + if (getparam(s+2, "sample threshold", 'r', &maxdiff)) + pdepth = 0; break; default: goto badparam; @@ -535,10 +537,11 @@ char *s; (*dev->comout)(buf); } (*dev->comin)(buf, NULL); - sprintf(buf, "with value (%.6g %.6g %.6g)", + sprintf(buf, "value (%.5g %.5g %.5g) (%.1fL)", colval(thisray.rcol,RED), colval(thisray.rcol,GRN), - colval(thisray.rcol,BLU)); + colval(thisray.rcol,BLU), + luminance(thisray.rcol)); (*dev->comout)(buf); } (*dev->comin)(buf, NULL); @@ -581,7 +584,7 @@ char *s; fputaspect(dev->pixaspect, fp); fputformat(COLRFMT, fp); putc('\n', fp); - fputresolu(YMAJOR|YDECR, hresolu, vresolu, fp); + fprtresolu(hresolu, vresolu, fp); scanline = (COLR *)malloc(hresolu*sizeof(COLR)); if (scanline == NULL) {