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.7 by greg, Tue Feb 18 16:38:51 1992 UTC

# 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 86 | Line 93 | char  *s;
93          (*dev->comout)(buf);
94          (*dev->comin)(buf, NULL);
95          if (buf[0] == CTRL('C')) return;
96 <        if (sscanf(buf, "%lf %lf %lf", &nv.vp[0], &nv.vp[1], &nv.vp[2]) == 3)
96 >        if (sscanvec(buf, nv.vp))
97                  change++;
98          else
99                  VCOPY(nv.vp, ourview.vp);
# Line 95 | Line 102 | char  *s;
102          (*dev->comout)(buf);
103          (*dev->comin)(buf, NULL);
104          if (buf[0] == CTRL('C')) return;
105 <        if (sscanf(buf,"%lf %lf %lf",&nv.vdir[0],&nv.vdir[1],&nv.vdir[2]) == 3)
105 >        if (sscanvec(buf, nv.vdir))
106                  change++;
107          else
108                  VCOPY(nv.vdir, ourview.vdir);
# Line 104 | Line 111 | char  *s;
111          (*dev->comout)(buf);
112          (*dev->comin)(buf, NULL);
113          if (buf[0] == CTRL('C')) return;
114 <        if (sscanf(buf,"%lf %lf %lf",&nv.vup[0],&nv.vup[1],&nv.vup[2]) == 3)
114 >        if (sscanvec(buf, nv.vup))
115                  change++;
116          else
117                  VCOPY(nv.vup, ourview.vup);
# Line 290 | Line 297 | char  *s;
297                          e *= atof(cp);
298          }
299          if (p != NULL) {                /* relative setting */
300 <                if (bright(p->v) <= FTINY) {
300 >                if (bright(p->v) < 1e-25) {
301                          error(COMMAND, "cannot normalize to zero");
302                          return;
303                  }
# Line 387 | Line 394 | register char  *s;
394          extern int  directinvis;
395          extern double  srcsizerat;
396          extern int  do_irrad;
397 +        extern double  specjitter;
398 +        extern double  specthresh;
399          char  buf[128];
400          
401          if (s[0] == '\0') {
402                  (*dev->comout)(
403 <                        "aa ab ad ar as av b dc di dj ds dt i lr lw sp st: ");
403 >                "aa ab ad ar as av b dc di dj ds dt i lr lw ps pt sj st: ");
404                  (*dev->comin)(buf, NULL);
405                  s = buf;
406          }
# Line 462 | Line 471 | register char  *s;
471                          goto badparam;
472                  }
473                  break;
474 <        case 's':                       /* sample */
474 >        case 'p':                       /* pixel */
475                  switch (s[1]) {
476 <                case 'p':                       /* pixel */
477 <                        if (getparam(s+2, "sample pixel", 'i', &psample))
476 >                case 's':                       /* sample */
477 >                        if (getparam(s+2, "pixel sample", 'i', &psample))
478                                  pdepth = 0;
479                          break;
480                  case 't':                       /* threshold */
481 <                        if (getparam(s+2, "sample threshold", 'r', &maxdiff))
481 >                        if (getparam(s+2, "pixel threshold", 'r', &maxdiff))
482                                  pdepth = 0;
483                          break;
484                  default:
485                          goto badparam;
486                  }
487                  break;
488 +        case 's':                       /* specular */
489 +                switch (s[1]) {
490 +                case 'j':                       /* jitter */
491 +                        getparam(s+2, "specular jitter", 'r', &specjitter);
492 +                        break;
493 +                case 't':                       /* threshold */
494 +                        getparam(s+2, "specular threshold", 'r', &specthresh);
495 +                        break;
496 +                default:
497 +                        goto badparam;
498 +                }
499 +                break;
500          case '\0':                      /* nothing */
501                  break;
502          default:;
# Line 495 | Line 516 | char  *s;
516          int  x, y;
517          RAY  thisray;
518  
519 <        if (sscanf(s, "%lf %lf %lf %lf %lf %lf",
520 <                &thisray.rorg[0], &thisray.rorg[1], &thisray.rorg[2],
500 <                &thisray.rdir[0], &thisray.rdir[1], &thisray.rdir[2]) != 6) {
519 >        if (!sscanvec(s, thisray.rorg) ||
520 >                        !sscanvec(sskip(sskip(sskip(s))), thisray.rdir)) {
521  
522                  if (dev->getcur == NULL)
523                          return;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines