--- ray/src/rt/rv2.c 1992/10/15 21:13:14 2.12 +++ ray/src/rt/rv2.c 1993/08/05 13:17:54 2.17 @@ -1,4 +1,4 @@ -/* Copyright (c) 1992 Regents of the University of California */ +/* Copyright (c) 1993 Regents of the University of California */ #ifndef lint static char SCCSid[] = "$SunId$ LBL"; @@ -263,13 +263,18 @@ char *s; { char buf[128]; register char *cp; - register PNODE *p; RECT r; int x, y; - double e; - + register PNODE *p = &ptrunk; + int adapt = 0; + double e = 1.0; +start: for (cp = s; isspace(*cp); cp++) ; + if (*cp == '@') { + adapt++; + goto start; + } if (*cp == '\0') { /* normalize to point */ if (dev->getcur == NULL) return; @@ -279,7 +284,6 @@ char *s; r.l = r.d = 0; r.r = hresolu; r.u = vresolu; p = findrect(x, y, &ptrunk, &r, -1); - e = 1.0; } else { if (*cp == '=') { /* absolute setting */ p = NULL; @@ -287,7 +291,7 @@ char *s; for (cp++; isspace(*cp); cp++) ; if (*cp == '\0') { /* interactive */ - sprintf(buf, "exposure (%lf): ", exposure); + sprintf(buf, "exposure (%f): ", exposure); (*dev->comout)(buf); (*dev->comin)(buf, NULL); for (cp = buf; isspace(*cp); cp++) @@ -295,9 +299,6 @@ char *s; if (*cp == '\0') return; } - } else { /* normalize to average */ - p = &ptrunk; - e = 1.0; } if (*cp == '+' || *cp == '-') /* f-stops */ e *= pow(2.0, atof(cp)); @@ -305,11 +306,14 @@ char *s; e *= atof(cp); } if (p != NULL) { /* relative setting */ - if (bright(p->v) < 1e-25) { + if (bright(p->v) < 1e-15) { error(COMMAND, "cannot normalize to zero"); return; } - e *= 0.5 / bright(p->v); + if (adapt) + e *= 106./pow(1.219+pow(luminance(p->v)/exposure,.4),2.5)/exposure; + else + e *= 0.5 / bright(p->v); } if (e <= FTINY || fabs(1.0 - e) <= FTINY) return; @@ -398,7 +402,7 @@ register char *s; extern int ambdiv; extern int ambssamp; extern int ambounce; - extern int directinvis; + extern int directvis; extern double srcsizerat; extern int do_irrad; extern double specjitter; @@ -435,9 +439,9 @@ register char *s; case 't': /* threshold */ getparam(s+2, "direct threshold", 'r', &shadthresh); break; - case 'i': /* invisibility */ - getparam(s+2, "direct invisibility", - 'b', &directinvis); + case 'v': /* visibility */ + getparam(s+2, "direct visibility", + 'b', &directvis); break; case 's': /* sampling */ getparam(s+2, "direct sampling", 'r', &srcsizerat); @@ -458,7 +462,8 @@ register char *s; getparam(s+2, "ambient value", 'C', (COLOR *)ambval); break; case 'a': /* accuracy */ - getparam(s+2, "ambient accuracy", 'r', &ambacc); + if (getparam(s+2, "ambient accuracy", 'r', &ambacc)) + setambacc(ambacc); break; case 'd': /* divisions */ getparam(s+2, "ambient divisions", 'i', &ambdiv);