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.4 by greg, Mon Dec 23 23:18:31 1991 UTC vs.
Revision 2.9 by greg, Mon Apr 6 18:04:19 1992 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1991 Regents of the University of California */
1 > /* Copyright (c) 1992 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 24 | Line 24 | static char SCCSid[] = "$SunId$ LBL";
24  
25   #define  CTRL(c)        ((c)-'@')
26  
27 + #ifdef  SMLFLT
28 + #define  sscanvec(s,v)  (sscanf(s,"%f %f %f",v,v+1,v+2)==3)
29 + #else
30 + #define  sscanvec(s,v)  (sscanf(s,"%lf %lf %lf",v,v+1,v+2)==3)
31 + #endif
32 +
33 +
34   extern char  VersionID[];
35   extern char  *progname;
36   extern char  *octname;
# Line 58 | 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 86 | Line 103 | char  *s;
103          (*dev->comout)(buf);
104          (*dev->comin)(buf, NULL);
105          if (buf[0] == CTRL('C')) return;
106 <        if (sscanf(buf, "%lf %lf %lf", &nv.vp[0], &nv.vp[1], &nv.vp[2]) == 3)
106 >        if (sscanvec(buf, nv.vp))
107                  change++;
108          else
109                  VCOPY(nv.vp, ourview.vp);
# Line 95 | Line 112 | char  *s;
112          (*dev->comout)(buf);
113          (*dev->comin)(buf, NULL);
114          if (buf[0] == CTRL('C')) return;
115 <        if (sscanf(buf,"%lf %lf %lf",&nv.vdir[0],&nv.vdir[1],&nv.vdir[2]) == 3)
115 >        if (sscanvec(buf, nv.vdir))
116                  change++;
117          else
118                  VCOPY(nv.vdir, ourview.vdir);
# Line 104 | Line 121 | char  *s;
121          (*dev->comout)(buf);
122          (*dev->comin)(buf, NULL);
123          if (buf[0] == CTRL('C')) return;
124 <        if (sscanf(buf,"%lf %lf %lf",&nv.vup[0],&nv.vup[1],&nv.vup[2]) == 3)
124 >        if (sscanvec(buf, nv.vup))
125                  change++;
126          else
127                  VCOPY(nv.vup, ourview.vup);
# Line 290 | Line 307 | char  *s;
307                          e *= atof(cp);
308          }
309          if (p != NULL) {                /* relative setting */
310 <                if (bright(p->v) <= FTINY) {
310 >                if (bright(p->v) < 1e-25) {
311                          error(COMMAND, "cannot normalize to zero");
312                          return;
313                  }
# Line 379 | Line 396 | register char  *s;
396          extern double  shadcert;
397          extern COLOR  ambval;
398          extern double  ambacc;
382        extern double  minarad;
399          extern int  ambres;
400          extern int  ambdiv;
401          extern int  ambssamp;
# Line 387 | Line 403 | register char  *s;
403          extern int  directinvis;
404          extern double  srcsizerat;
405          extern int  do_irrad;
406 +        extern double  specjitter;
407 +        extern double  specthresh;
408          char  buf[128];
409          
410          if (s[0] == '\0') {
411                  (*dev->comout)(
412 <                        "aa ab ad ar as av b dc di dj ds dt i lr lw sp st: ");
412 >                "aa ab ad ar as av b dc di dj ds dt i lr lw ps pt sj st: ");
413                  (*dev->comin)(buf, NULL);
414                  s = buf;
415          }
# Line 455 | Line 473 | register char  *s;
473                          break;
474                  case 'r':
475                          if (getparam(s+2, "ambient resolution", 'i', &ambres))
476 <                                minarad = ambres > 0 ?
459 <                                                thescene.cusize/ambres : 0.0;
476 >                                setambres(ambres);
477                          break;
478                  default:
479                          goto badparam;
480                  }
481                  break;
482 <        case 's':                       /* sample */
482 >        case 'p':                       /* pixel */
483                  switch (s[1]) {
484 <                case 'p':                       /* pixel */
485 <                        if (getparam(s+2, "sample pixel", 'i', &psample))
484 >                case 's':                       /* sample */
485 >                        if (getparam(s+2, "pixel sample", 'i', &psample))
486                                  pdepth = 0;
487                          break;
488                  case 't':                       /* threshold */
489 <                        if (getparam(s+2, "sample threshold", 'r', &maxdiff))
489 >                        if (getparam(s+2, "pixel threshold", 'r', &maxdiff))
490                                  pdepth = 0;
491                          break;
492                  default:
493                          goto badparam;
494                  }
495                  break;
496 +        case 's':                       /* specular */
497 +                switch (s[1]) {
498 +                case 'j':                       /* jitter */
499 +                        getparam(s+2, "specular jitter", 'r', &specjitter);
500 +                        break;
501 +                case 't':                       /* threshold */
502 +                        getparam(s+2, "specular threshold", 'r', &specthresh);
503 +                        break;
504 +                default:
505 +                        goto badparam;
506 +                }
507 +                break;
508          case '\0':                      /* nothing */
509                  break;
510          default:;
# Line 495 | Line 524 | char  *s;
524          int  x, y;
525          RAY  thisray;
526  
527 <        if (sscanf(s, "%lf %lf %lf %lf %lf %lf",
528 <                &thisray.rorg[0], &thisray.rorg[1], &thisray.rorg[2],
500 <                &thisray.rdir[0], &thisray.rdir[1], &thisray.rdir[2]) != 6) {
527 >        if (!sscanvec(s, thisray.rorg) ||
528 >                        !sscanvec(sskip(sskip(sskip(s))), thisray.rdir)) {
529  
530                  if (dev->getcur == NULL)
531                          return;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines