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 1.2 by greg, Fri Feb 3 07:58:07 1989 UTC vs.
Revision 1.3 by greg, Fri Mar 3 18:34:33 1989 UTC

# Line 75 | Line 75 | char  *s;
75          FILE  *fp;
76          char  buf[128];
77          char  *fname, *getpath();
78 +        int  change = 0;
79          VIEW  nv;
80  
81          if (sscanf(s, "%s", buf) == 1) {        /* write parameters to a file */
# Line 94 | Line 95 | char  *s;
95          (*dev->comout)(buf);
96          (*dev->comin)(buf);
97          if (buf[0] == CTRL(C)) return;
98 <        if (buf[0])
98 >        if (buf[0] && buf[0] != ourview.type) {
99                  nv.type = buf[0];
100 <        else
100 >                change++;
101 >        } else
102                  nv.type = ourview.type;
103          sprintf(buf, "view point (%.6g %.6g %.6g): ",
104                          ourview.vp[0], ourview.vp[1], ourview.vp[2]);
105          (*dev->comout)(buf);
106          (*dev->comin)(buf);
107          if (buf[0] == CTRL(C)) return;
108 <        if (sscanf(buf, "%lf %lf %lf", &nv.vp[0], &nv.vp[1], &nv.vp[2]) != 3)
108 >        if (sscanf(buf, "%lf %lf %lf", &nv.vp[0], &nv.vp[1], &nv.vp[2]) == 3)
109 >                change++;
110 >        else
111                  VCOPY(nv.vp, ourview.vp);
112          sprintf(buf, "view direction (%.6g %.6g %.6g): ",
113                          ourview.vdir[0], ourview.vdir[1], ourview.vdir[2]);
114          (*dev->comout)(buf);
115          (*dev->comin)(buf);
116          if (buf[0] == CTRL(C)) return;
117 <        if (sscanf(buf,"%lf %lf %lf",&nv.vdir[0],&nv.vdir[1],&nv.vdir[2]) != 3)
117 >        if (sscanf(buf,"%lf %lf %lf",&nv.vdir[0],&nv.vdir[1],&nv.vdir[2]) == 3)
118 >                change++;
119 >        else
120                  VCOPY(nv.vdir, ourview.vdir);
121          sprintf(buf, "view up (%.6g %.6g %.6g): ",
122                          ourview.vup[0], ourview.vup[1], ourview.vup[2]);
123          (*dev->comout)(buf);
124          (*dev->comin)(buf);
125          if (buf[0] == CTRL(C)) return;
126 <        if (sscanf(buf,"%lf %lf %lf",&nv.vup[0],&nv.vup[1],&nv.vup[2]) != 3)
126 >        if (sscanf(buf,"%lf %lf %lf",&nv.vup[0],&nv.vup[1],&nv.vup[2]) == 3)
127 >                change++;
128 >        else
129                  VCOPY(nv.vup, ourview.vup);
130          sprintf(buf, "view horiz and vert size (%.6g %.6g): ",
131                          ourview.horiz, ourview.vert);
132          (*dev->comout)(buf);
133          (*dev->comin)(buf);
134          if (buf[0] == CTRL(C)) return;
135 <        if (sscanf(buf, "%lf %lf", &nv.horiz, &nv.vert) != 2) {
135 >        if (sscanf(buf, "%lf %lf", &nv.horiz, &nv.vert) == 2)
136 >                change++;
137 >        else {
138                  nv.horiz = ourview.horiz; nv.vert = ourview.vert;
139          }
140          sprintf(buf, "x and y resolution (%d %d): ",
# Line 132 | Line 142 | char  *s;
142          (*dev->comout)(buf);
143          (*dev->comin)(buf);
144          if (buf[0] == CTRL(C)) return;
145 <        if (sscanf(buf, "%d %d", &nv.hresolu, &nv.vresolu) != 2) {
145 >        if (sscanf(buf, "%d %d", &nv.hresolu, &nv.vresolu) == 2)
146 >                change++;
147 >        else {
148                  nv.hresolu = ourview.hresolu; nv.vresolu = ourview.vresolu;
149          }
150 <        newview(&nv);
150 >        if (change)
151 >                newview(&nv);
152   }
153  
154  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines