--- ray/src/rt/rv2.c 1990/02/05 09:57:45 1.19 +++ ray/src/rt/rv2.c 1991/07/18 15:49:06 1.23 @@ -151,7 +151,7 @@ char *s; newview(&nv); return; } - if (oldview.horiz == 0) { /* no old view! */ + if (oldview.type == 0) { /* no old view! */ error(COMMAND, "no previous view"); return; } @@ -171,18 +171,12 @@ char *s; if (getinterest(s, 1, nv.vdir, &zfact) < 0) return; + nv.type = ourview.type; VCOPY(nv.vp, ourview.vp); VCOPY(nv.vup, ourview.vup); nv.hoff = ourview.hoff; nv.voff = ourview.voff; - if ((nv.type = ourview.type) == VT_PAR) { - nv.horiz = ourview.horiz / zfact; - nv.vert = ourview.vert / zfact; - } else { - nv.horiz = atan(tan(ourview.horiz*(PI/180./2.))/zfact) / - (PI/180./2.); - nv.vert = atan(tan(ourview.vert*(PI/180./2.))/zfact) / - (PI/180./2.); - } + nv.horiz = ourview.horiz; nv.vert = ourview.vert; + zoomview(&nv, zfact); newview(&nv); } @@ -212,6 +206,7 @@ char *s; error(COMMAND, "missing angle"); return; } + nv.type = ourview.type; VCOPY(nv.vp, ourview.vp); VCOPY(nv.vup, ourview.vup); nv.hoff = ourview.hoff; nv.voff = ourview.voff; @@ -221,15 +216,8 @@ char *s; normalize(v1); spinvector(nv.vdir, nv.vdir, v1, elev*(PI/180.)); } - if ((nv.type = ourview.type) == VT_PAR) { - nv.horiz = ourview.horiz / zfact; - nv.vert = ourview.vert / zfact; - } else { - nv.horiz = atan(tan(ourview.horiz*(PI/180./2.))/zfact) / - (PI/180./2.); - nv.vert = atan(tan(ourview.vert*(PI/180./2.))/zfact) / - (PI/180./2.); - } + nv.horiz = ourview.horiz; nv.vert = ourview.vert; + zoomview(&nv, zfact); newview(&nv); } @@ -330,12 +318,15 @@ register char *s; extern int ambdiv; extern int ambssamp; extern int ambounce; + extern int directinvis; + extern int do_irrad; int i0; double d0, d1, d2; - char buf[128]; + char buf[128], ans[4]; if (s[0] == '\0') { - (*dev->comout)("aa ab ad ar as av dc dj dt lr lw sp st: "); + (*dev->comout)( + "aa ab ad ar as av b dc dj di dt i lr lw sp st: "); (*dev->comin)(buf, NULL); s = buf; } @@ -403,10 +394,43 @@ register char *s; } shadthresh = d0; break; + case 'i': /* invisibility */ + if (sscanf(s+2, "%1s", ans) != 1) { + sprintf(buf, "direct invisibility (%c): ", + directinvis ? 'y' : 'n'); + (*dev->comout)(buf); + (*dev->comin)(buf, NULL); + if (sscanf(buf, "%1s", ans) != 1) + break; + } + directinvis = tolower(ans[0]) == 'y'; + break; default: goto badparam; } break; + case 'b': /* black and white */ + if (sscanf(s+1, "%1s", ans) != 1) { + sprintf(buf, "black and white (%c): ", + greyscale ? 'y' : 'n'); + (*dev->comout)(buf); + (*dev->comin)(buf, NULL); + if (sscanf(buf, "%1s", ans) != 1) + break; + } + greyscale = tolower(ans[0]) == 'y'; + break; + case 'i': /* irradiance */ + if (sscanf(s+1, "%1s", ans) != 1) { + sprintf(buf, "irradiance (%c): ", + do_irrad ? 'y' : 'n'); + (*dev->comout)(buf); + (*dev->comin)(buf, NULL); + if (sscanf(buf, "%1s", ans) != 1) + break; + } + do_irrad = tolower(ans[0]) == 'y'; + break; case 'a': /* ambient */ switch (s[1]) { case 'v': /* value */ @@ -541,9 +565,12 @@ char *s; if ((*dev->getcur)(&x, &y) == ABORT) return; - viewray(thisray.rorg, thisray.rdir, &ourview, - (x+.5)/hresolu, (y+.5)/vresolu); - + if (viewray(thisray.rorg, thisray.rdir, &ourview, + (x+.5)/hresolu, (y+.5)/vresolu) < 0) { + error(COMMAND, "not on image"); + return; + } + } else if (normalize(thisray.rdir) == 0.0) { error(COMMAND, "zero ray direction"); return; @@ -610,6 +637,7 @@ char *s; fputexpos(exposure, fp); if (dev->pixaspect != 1.0) fputaspect(dev->pixaspect, fp); + fputformat(COLRFMT, fp); putc('\n', fp); fputresolu(YMAJOR|YDECR, hresolu, vresolu, fp);