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.5 by greg, Wed Jan 15 16:55:21 1992 UTC vs.
Revision 2.11 by greg, Tue Oct 6 17:13:42 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 169 | Line 186 | char  *s;
186   getaim(s)                               /* aim camera */
187   char  *s;
188   {
172        extern double  tan(), atan();
189          double  zfact;
190          VIEW  nv;
191  
# Line 200 | Line 216 | char  *s;
216   getrotate(s)                            /* rotate camera */
217   char  *s;
218   {
203        extern double  normalize(), tan(), atan();
219          VIEW  nv;
220          FVECT  v1;
221          double  angle, elev, zfact;
# Line 290 | Line 305 | char  *s;
305                          e *= atof(cp);
306          }
307          if (p != NULL) {                /* relative setting */
308 <                if (bright(p->v) <= FTINY) {
308 >                if (bright(p->v) < 1e-25) {
309                          error(COMMAND, "cannot normalize to zero");
310                          return;
311                  }
# Line 379 | Line 394 | register char  *s;
394          extern double  shadcert;
395          extern COLOR  ambval;
396          extern double  ambacc;
382        extern double  minarad;
397          extern int  ambres;
398          extern int  ambdiv;
399          extern int  ambssamp;
# Line 441 | Line 455 | register char  *s;
455          case 'a':                       /* ambient */
456                  switch (s[1]) {
457                  case 'v':                       /* value */
458 <                        getparam(s+2, "ambient value", 'C', ambval);
458 >                        getparam(s+2, "ambient value", 'C', (COLOR *)ambval);
459                          break;
460                  case 'a':                       /* accuracy */
461                          getparam(s+2, "ambient accuracy", 'r', &ambacc);
# Line 457 | Line 471 | register char  *s;
471                          break;
472                  case 'r':
473                          if (getparam(s+2, "ambient resolution", 'i', &ambres))
474 <                                minarad = ambres > 0 ?
461 <                                                thescene.cusize/ambres : 0.0;
474 >                                setambres(ambres);
475                          break;
476                  default:
477                          goto badparam;
# Line 509 | Line 522 | char  *s;
522          int  x, y;
523          RAY  thisray;
524  
525 <        if (sscanf(s, "%lf %lf %lf %lf %lf %lf",
526 <                &thisray.rorg[0], &thisray.rorg[1], &thisray.rorg[2],
514 <                &thisray.rdir[0], &thisray.rdir[1], &thisray.rdir[2]) != 6) {
525 >        if (!sscanvec(s, thisray.rorg) ||
526 >                        !sscanvec(sskip(sskip(sskip(s))), thisray.rdir)) {
527  
528                  if (dev->getcur == NULL)
529                          return;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines