--- ray/src/rt/rv2.c 1994/01/06 15:52:17 2.23 +++ ray/src/rt/rv2.c 1996/02/14 15:25:34 2.34 @@ -1,4 +1,4 @@ -/* Copyright (c) 1993 Regents of the University of California */ +/* Copyright (c) 1995 Regents of the University of California */ #ifndef lint static char SCCSid[] = "$SunId$ LBL"; @@ -140,6 +140,16 @@ char *s; else { nv.horiz = ourview.horiz; nv.vert = ourview.vert; } + sprintf(buf, "fore and aft clipping plane (%.6g %.6g): ", + ourview.vfore, ourview.vaft); + (*dev->comout)(buf); + (*dev->comin)(buf, NULL); + if (buf[0] == CTRL('C')) return; + if (sscanf(buf, "%lf %lf", &nv.vfore, &nv.vaft) == 2) + change++; + else { + nv.vfore = ourview.vfore; nv.vaft = ourview.vaft; + } sprintf(buf, "view shift and lift (%.6g %.6g): ", ourview.hoff, ourview.voff); (*dev->comout)(buf); @@ -276,8 +286,9 @@ char *s; nv.type = ourview.type; VCOPY(nv.vp, ourview.vp); VCOPY(nv.vup, ourview.vup); - nv.hoff = ourview.hoff; nv.voff = ourview.voff; nv.horiz = ourview.horiz; nv.vert = ourview.vert; + nv.vfore = ourview.vfore; nv.vaft = ourview.vaft; + nv.hoff = ourview.hoff; nv.voff = ourview.voff; zoomview(&nv, zfact); newview(&nv); } @@ -311,6 +322,7 @@ char *s; VCOPY(nv.vp, ourview.vp); VCOPY(nv.vup, ourview.vup); nv.hoff = ourview.hoff; nv.voff = ourview.voff; + nv.vfore = ourview.vfore; nv.vaft = ourview.vaft; spinvector(nv.vdir, ourview.vdir, ourview.vup, angle*(PI/180.)); if (elev != 0.0) { fcross(v1, nv.vdir, ourview.vup); @@ -334,7 +346,7 @@ register char *s; error(COMMAND, "missing angle"); return; } - if (getinterest(sskip(sskip(s)), 0, vc, &mag) < 0) + if (getinterest(sskip2(s,2), 0, vc, &mag) < 0) return; moveview(angle, elev, mag, vc); } @@ -350,12 +362,13 @@ char *s; register PNODE *p = &ptrunk; int adapt = 0; double e = 1.0; -start: + for (cp = s; isspace(*cp); cp++) ; if (*cp == '@') { adapt++; - goto start; + while (isspace(*++cp)) + ; } if (*cp == '\0') { /* normalize to point */ if (dev->getcur == NULL) @@ -479,21 +492,27 @@ register char *s; extern double shadthresh; extern double shadcert; extern COLOR ambval; + extern int ambvwt; extern double ambacc; extern int ambres; extern int ambdiv; extern int ambssamp; extern int ambounce; + extern COLOR cextinction; + extern double salbedo; + extern double seccg; + extern double ssampdist; extern int directvis; extern double srcsizerat; extern int do_irrad; extern double specjitter; extern double specthresh; + extern int backvis; char buf[128]; if (s[0] == '\0') { (*dev->comout)( - "aa ab ad ar as av b dc di dj ds dt i lr lw ps pt sj st: "); + "aa ab ad ar as av aw b dc dv dj ds dt i lr lw me ma mg ms ps pt sj st bv: "); (*dev->comin)(buf, NULL); s = buf; } @@ -532,8 +551,20 @@ register char *s; goto badparam; } break; - case 'b': /* black and white */ - getparam(s+1, "black and white", 'b', &greyscale); + case 'b': /* back faces or black and white */ + switch (s[1]) { + case 'v': /* back face visibility */ + getparam(s+2, "back face visibility", 'b', &backvis); + break; + case '\0': /* black and white */ + case ' ': + case 'y': case 'Y': case 't': case 'T': case '1': case '+': + case 'n': case 'N': case 'f': case 'F': case '0': case '-': + getparam(s+1, "black and white", 'b', &greyscale); + break; + default: + goto badparam; + } break; case 'i': /* irradiance */ getparam(s+1, "irradiance", 'b', &do_irrad); @@ -543,6 +574,9 @@ register char *s; case 'v': /* value */ getparam(s+2, "ambient value", 'C', (COLOR *)ambval); break; + case 'w': /* weight */ + getparam(s+2, "ambient value weight", 'i', &ambvwt); + break; case 'a': /* accuracy */ if (getparam(s+2, "ambient accuracy", 'r', &ambacc)) setambacc(ambacc); @@ -564,6 +598,26 @@ register char *s; goto badparam; } break; + case 'm': /* medium */ + switch (s[1]) { + case 'e': /* extinction coefficient */ + getparam(s+2, "extinction coefficient", 'C', + (COLOR *)cextinction); + break; + case 'a': /* scattering albedo */ + getparam(s+2, "scattering albedo", 'r', &salbedo); + break; + case 'g': /* scattering eccentricity */ + getparam(s+2, "scattering eccentricity", 'r', &seccg); + break; + case 's': /* sampling distance */ + getparam(s+2, "mist sampling distance", 'r', + &ssampdist); + break; + default: + goto badparam; + } + break; case 'p': /* pixel */ switch (s[1]) { case 's': /* sample */ @@ -609,8 +663,10 @@ char *s; int x, y; RAY thisray; + thisray.rmax = 0.0; + if (!sscanvec(s, thisray.rorg) || - !sscanvec(sskip(sskip(sskip(s))), thisray.rdir)) { + !sscanvec(sskip2(s,3), thisray.rdir)) { if (dev->getcur == NULL) return; @@ -618,8 +674,8 @@ char *s; if ((*dev->getcur)(&x, &y) == ABORT) return; - if (viewray(thisray.rorg, thisray.rdir, &ourview, - (x+.5)/hresolu, (y+.5)/vresolu) < 0) { + if ((thisray.rmax = viewray(thisray.rorg, thisray.rdir, + &ourview, (x+.5)/hresolu, (y+.5)/vresolu)) < -FTINY) { error(COMMAND, "not on image"); return; } @@ -647,8 +703,9 @@ char *s; if (thisray.rot >= FHUGE) (*dev->comout)("at infinity"); else { - sprintf(buf, "at (%.6g %.6g %.6g)", thisray.rop[0], - thisray.rop[1], thisray.rop[2]); + sprintf(buf, "at (%.6g %.6g %.6g) (%.6g)", + thisray.rop[0], thisray.rop[1], + thisray.rop[2], thisray.rt); (*dev->comout)(buf); } (*dev->comin)(buf, NULL); @@ -693,6 +750,7 @@ char *s; (*dev->comout)(fname); (*dev->comout)("\"...\n"); /* write header */ + newheader("RADIANCE", fp); fputs(progname, fp); fprintview(&ourview, fp); if (octname != NULL)