ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/rv2.c
(Generate patch)

Comparing ray/src/rt/rv2.c (file contents):
Revision 2.8 by greg, Wed Mar 4 16:52:10 1992 UTC vs.
Revision 2.16 by greg, Wed Jun 2 21:04:02 1993 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1991 Regents of the University of California */
1 > /* Copyright (c) 1993 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 65 | Line 65 | char  *s;
65          int  change = 0;
66          VIEW  nv;
67  
68 +        while (isspace(*s))
69 +                s++;
70 +        if (*s == '-') {                        /* command line parameters */
71 +                copystruct(&nv, &ourview);
72 +                if (sscanview(&nv, s))
73 +                        newview(&nv);
74 +                else
75 +                        error(COMMAND, "bad view option(s)");
76 +                return;
77 +        }
78          if (sscanf(s, "%s", buf) == 1) {        /* write parameters to a file */
79                  if ((fname = getpath(buf, NULL, 0)) == NULL ||
80                                  (fp = fopen(fname, "a")) == NULL) {
# Line 176 | Line 186 | char  *s;
186   getaim(s)                               /* aim camera */
187   char  *s;
188   {
179        extern double  tan(), atan();
189          double  zfact;
190          VIEW  nv;
191  
# Line 207 | Line 216 | char  *s;
216   getrotate(s)                            /* rotate camera */
217   char  *s;
218   {
210        extern double  normalize(), tan(), atan();
219          VIEW  nv;
220          FVECT  v1;
221          double  angle, elev, zfact;
# Line 255 | Line 263 | char  *s;
263   {
264          char  buf[128];
265          register char  *cp;
258        register PNODE  *p;
266          RECT  r;
267          int  x, y;
268 <        double  e;
269 <
268 >        register PNODE  *p = &ptrunk;
269 >        int  adapt = 0;
270 >        double  e = 1.0;
271 > start:
272          for (cp = s; isspace(*cp); cp++)
273                  ;
274 +        if (*cp == '@') {
275 +                adapt++;
276 +                goto start;
277 +        }
278          if (*cp == '\0') {              /* normalize to point */
279                  if (dev->getcur == NULL)
280                          return;
# Line 271 | Line 284 | char  *s;
284                  r.l = r.d = 0;
285                  r.r = hresolu; r.u = vresolu;
286                  p = findrect(x, y, &ptrunk, &r, -1);
274                e = 1.0;
287          } else {
288                  if (*cp == '=') {       /* absolute setting */
289                          p = NULL;
# Line 279 | Line 291 | char  *s;
291                          for (cp++; isspace(*cp); cp++)
292                                  ;
293                          if (*cp == '\0') {      /* interactive */
294 <                                sprintf(buf, "exposure (%lf): ", exposure);
294 >                                sprintf(buf, "exposure (%f): ", exposure);
295                                  (*dev->comout)(buf);
296                                  (*dev->comin)(buf, NULL);
297                                  for (cp = buf; isspace(*cp); cp++)
# Line 287 | Line 299 | char  *s;
299                                  if (*cp == '\0')
300                                          return;
301                          }
290                } else {                /* normalize to average */
291                        p = &ptrunk;
292                        e = 1.0;
302                  }
303                  if (*cp == '+' || *cp == '-')   /* f-stops */
304                          e *= pow(2.0, atof(cp));
# Line 297 | Line 306 | char  *s;
306                          e *= atof(cp);
307          }
308          if (p != NULL) {                /* relative setting */
309 <                if (bright(p->v) < 1e-25) {
309 >                if (bright(p->v) < 1e-15) {
310                          error(COMMAND, "cannot normalize to zero");
311                          return;
312                  }
313 <                e *= 0.5 / bright(p->v);
313 >                if (adapt)
314 >                        e *= 106./pow(1.219+pow(luminance(p->v)/exposure,.4),2.5)/exposure;
315 >                else
316 >                        e *= 0.5 / bright(p->v);
317          }
318          if (e <= FTINY || fabs(1.0 - e) <= FTINY)
319                  return;
# Line 390 | Line 402 | register char  *s;
402          extern int  ambdiv;
403          extern int  ambssamp;
404          extern int  ambounce;
405 <        extern int  directinvis;
405 >        extern int  directvis;
406          extern double  srcsizerat;
407          extern int  do_irrad;
408          extern double  specjitter;
# Line 427 | Line 439 | register char  *s;
439                  case 't':                       /* threshold */
440                          getparam(s+2, "direct threshold", 'r', &shadthresh);
441                          break;
442 <                case 'i':                       /* invisibility */
443 <                        getparam(s+2, "direct invisibility",
444 <                                        'b', &directinvis);
442 >                case 'v':                       /* visibility */
443 >                        getparam(s+2, "direct visibility",
444 >                                        'b', &directvis);
445                          break;
446                  case 's':                       /* sampling */
447                          getparam(s+2, "direct sampling", 'r', &srcsizerat);
# Line 447 | Line 459 | register char  *s;
459          case 'a':                       /* ambient */
460                  switch (s[1]) {
461                  case 'v':                       /* value */
462 <                        getparam(s+2, "ambient value", 'C', ambval);
462 >                        getparam(s+2, "ambient value", 'C', (COLOR *)ambval);
463                          break;
464                  case 'a':                       /* accuracy */
465                          getparam(s+2, "ambient accuracy", 'r', &ambacc);
# Line 585 | Line 597 | char  *s;
597                  error(COMMAND, errmsg);
598                  return;
599          }
600 + #ifdef MSDOS
601 +        setmode(fileno(fp), O_BINARY);
602 + #endif
603          (*dev->comout)("writing \"");
604          (*dev->comout)(fname);
605          (*dev->comout)("\"...\n");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines