--- ray/src/rt/rv2.c 1989/03/03 18:34:33 1.3 +++ ray/src/rt/rv2.c 1989/06/08 17:04:40 1.8 @@ -265,27 +265,25 @@ char *s; if (getinterest(s, 0, vc, &mag) < 0) return; - moveview(0.0, mag, vc); + moveview(0.0, 0.0, mag, vc); } getrotate(s) /* rotate camera */ char *s; { - extern double normalize(); + extern double normalize(), tan(), atan(); VIEW nv; FVECT v1; - double angle, elev; + double angle, elev, zfact; - elev = 0.0; - if (sscanf(s, "%lf %lf", &angle, &elev) < 1) { + elev = 0.0; zfact = 1.0; + if (sscanf(s, "%lf %lf %lf", &angle, &elev, &zfact) < 1) { error(COMMAND, "missing angle"); return; } - nv.type = ourview.type; VCOPY(nv.vp, ourview.vp); VCOPY(nv.vup, ourview.vup); - nv.horiz = ourview.horiz; nv.vert = ourview.vert; nv.hresolu = ourview.hresolu; nv.vresolu = ourview.vresolu; spinvector(nv.vdir, ourview.vdir, ourview.vup, angle*(PI/180.)); if (elev != 0.0) { @@ -293,6 +291,15 @@ 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.); + } newview(&nv); } @@ -301,15 +308,16 @@ getpivot(s) /* pivot viewpoint */ register char *s; { FVECT vc; - double angle, mag; + double angle, elev, mag; - if (sscanf(s, "%lf", &angle) != 1) { + elev = 0.0; + if (sscanf(s, "%lf %lf", &angle, &elev) < 1) { error(COMMAND, "missing angle"); return; } - if (getinterest(sskip(s), 0, vc, &mag) < 0) + if (getinterest(sskip(sskip(s)), 0, vc, &mag) < 0) return; - moveview(angle, mag, vc); + moveview(angle, elev, mag, vc); } @@ -361,11 +369,11 @@ char *s; e *= atof(cp); } if (p != NULL) { /* relative setting */ - if (intens(p->v) <= FTINY) { + if (bright(p->v) <= FTINY) { error(COMMAND, "cannot normalize to zero"); return; } - e *= 0.5 / intens(p->v); + e *= 0.5 / bright(p->v); } if (e <= FTINY || fabs(1.0 - e) <= FTINY) return; @@ -383,6 +391,7 @@ register char *s; extern double minweight; extern int maxdepth; extern double dstrsrc; + extern double shadthresh; extern COLOR ambval; extern double ambacc; extern double minarad; @@ -395,7 +404,7 @@ register char *s; char buf[128]; if (s[0] == '\0') { - (*dev->comout)("aa ab ad ar as av ds lr lw sd sp: "); + (*dev->comout)("aa ab ad ar as av dj dt lr lw sp st: "); (*dev->comin)(buf); s = buf; } @@ -428,17 +437,33 @@ register char *s; goto badparam; } break; - case 'd': /* distribute source */ - if (s[1] != 's') + case 'd': /* direct */ + switch (s[1]) { + case 'j': /* jitter */ + if (sscanf(s+2, "%lf", &d0) != 1) { + sprintf(buf, "direct jitter (%.6g): ", + dstrsrc); + (*dev->comout)(buf); + (*dev->comin)(buf); + if (sscanf(buf, "%lf", &d0) != 1) + break; + } + dstrsrc = d0; + break; + case 't': /* threshold */ + if (sscanf(s+2, "%lf", &d0) != 1) { + sprintf(buf, "direct threshold (%.6g): ", + shadthresh); + (*dev->comout)(buf); + (*dev->comin)(buf); + if (sscanf(buf, "%lf", &d0) != 1) + break; + } + shadthresh = d0; + break; + default: goto badparam; - if (sscanf(s+2, "%lf", &d0) != 1) { - sprintf(buf, "distribute source (%.6g): ", dstrsrc); - (*dev->comout)(buf); - (*dev->comin)(buf); - if (sscanf(buf, "%lf", &d0) != 1) - break; } - dstrsrc = d0; break; case 'a': /* ambient */ switch (s[1]) { @@ -530,9 +555,9 @@ register char *s; psample = i0; pdepth = 0; break; - case 'd': /* difference */ + case 't': /* threshold */ if (sscanf(s+2, "%lf", &d0) != 1) { - sprintf(buf, "sample difference (%.6g): ", + sprintf(buf, "sample threshold (%.6g): ", maxdiff); (*dev->comout)(buf); (*dev->comin)(buf);