--- ray/src/rt/rv2.c 1991/08/26 12:53:21 1.27 +++ ray/src/rt/rv2.c 1991/11/11 17:42:19 1.33 @@ -18,11 +18,15 @@ static char SCCSid[] = "$SunId$ LBL"; #include "rpaint.h" +#include "resolu.h" + #include #define CTRL(c) ('c'-'@') +extern char VersionID[]; extern char *progname; +extern char *octname; getframe(s) /* get a new frame */ @@ -140,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; @@ -319,10 +323,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); @@ -330,10 +334,10 @@ 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); @@ -342,10 +346,10 @@ register union {int i; double d; COLOR C;} *ptr; (*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); @@ -356,10 +360,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); } } @@ -382,12 +386,13 @@ register char *s; extern int ambssamp; extern int ambounce; extern int directinvis; + extern double srcsizerat; extern int do_irrad; char buf[128]; 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; } @@ -419,6 +424,9 @@ register char *s; getparam(s+2, "direct invisibility", 'b', &directinvis); break; + case 's': /* sampling */ + getparam(s+2, "direct sampling", 'r', &srcsizerat); + break; default: goto badparam; } @@ -447,8 +455,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; @@ -457,12 +466,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; @@ -529,10 +538,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); @@ -564,14 +574,18 @@ char *s; /* write header */ fputs(progname, fp); fprintview(&ourview, fp); - putc('\n', fp); + if (octname != NULL) + fprintf(fp, " %s\n", octname); + else + putc('\n', fp); + fprintf(fp, "SOFTWARE= %s\n", VersionID); if (exposure != 1.0) fputexpos(exposure, fp); if (dev->pixaspect != 1.0) 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) {