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.16 by greg, Tue Jan 16 11:30:13 1990 UTC vs.
Revision 1.22 by greg, Fri Apr 19 12:45:34 1991 UTC

# Line 63 | Line 63 | char  *s;
63                  }
64                  fputs(progname, fp);
65                  fprintview(&ourview, fp);
66 +                fputs(sskip(s), fp);
67                  fputs("\n", fp);
68                  fclose(fp);
69                  return;
70          }
71          sprintf(buf, "view type (%c): ", ourview.type);
72          (*dev->comout)(buf);
73 <        (*dev->comin)(buf);
73 >        (*dev->comin)(buf, NULL);
74          if (buf[0] == CTRL(C)) return;
75          if (buf[0] && buf[0] != ourview.type) {
76                  nv.type = buf[0];
# Line 79 | Line 80 | char  *s;
80          sprintf(buf, "view point (%.6g %.6g %.6g): ",
81                          ourview.vp[0], ourview.vp[1], ourview.vp[2]);
82          (*dev->comout)(buf);
83 <        (*dev->comin)(buf);
83 >        (*dev->comin)(buf, NULL);
84          if (buf[0] == CTRL(C)) return;
85          if (sscanf(buf, "%lf %lf %lf", &nv.vp[0], &nv.vp[1], &nv.vp[2]) == 3)
86                  change++;
# Line 88 | Line 89 | char  *s;
89          sprintf(buf, "view direction (%.6g %.6g %.6g): ",
90                          ourview.vdir[0], ourview.vdir[1], ourview.vdir[2]);
91          (*dev->comout)(buf);
92 <        (*dev->comin)(buf);
92 >        (*dev->comin)(buf, NULL);
93          if (buf[0] == CTRL(C)) return;
94          if (sscanf(buf,"%lf %lf %lf",&nv.vdir[0],&nv.vdir[1],&nv.vdir[2]) == 3)
95                  change++;
# Line 97 | Line 98 | char  *s;
98          sprintf(buf, "view up (%.6g %.6g %.6g): ",
99                          ourview.vup[0], ourview.vup[1], ourview.vup[2]);
100          (*dev->comout)(buf);
101 <        (*dev->comin)(buf);
101 >        (*dev->comin)(buf, NULL);
102          if (buf[0] == CTRL(C)) return;
103          if (sscanf(buf,"%lf %lf %lf",&nv.vup[0],&nv.vup[1],&nv.vup[2]) == 3)
104                  change++;
# Line 106 | Line 107 | char  *s;
107          sprintf(buf, "view horiz and vert size (%.6g %.6g): ",
108                          ourview.horiz, ourview.vert);
109          (*dev->comout)(buf);
110 <        (*dev->comin)(buf);
110 >        (*dev->comin)(buf, NULL);
111          if (buf[0] == CTRL(C)) return;
112          if (sscanf(buf, "%lf %lf", &nv.horiz, &nv.vert) == 2)
113                  change++;
# Line 116 | Line 117 | char  *s;
117          sprintf(buf, "view shift and lift (%.6g %.6g): ",
118                          ourview.hoff, ourview.voff);
119          (*dev->comout)(buf);
120 <        (*dev->comin)(buf);
120 >        (*dev->comin)(buf, NULL);
121          if (buf[0] == CTRL(C)) return;
122          if (sscanf(buf, "%lf %lf", &nv.hoff, &nv.voff) == 2)
123                  change++;
# Line 137 | Line 138 | char  *s;
138          VIEW  nv;
139  
140          if (sscanf(s, "%s", buf) == 1) {        /* get parameters from a file */
141 <                copyview(&nv, &stdview);
141 >                copystruct(&nv, &stdview);
142                  if ((fname = getpath(buf, NULL, 0)) == NULL ||
143                                  (success = viewfile(fname, &nv, 0, 0)) == -1) {
144                          sprintf(errmsg, "cannot open \"%s\"", buf);
# Line 150 | Line 151 | char  *s;
151                          newview(&nv);
152                  return;
153          }
154 <        if (oldview.horiz == 0) {       /* no old view! */
154 >        if (oldview.type == 0) {        /* no old view! */
155                  error(COMMAND, "no previous view");
156                  return;
157          }
158 <        copyview(&nv, &ourview);
159 <        copyview(&ourview, &oldview);
160 <        copyview(&oldview, &nv);
158 >        copystruct(&nv, &ourview);
159 >        copystruct(&ourview, &oldview);
160 >        copystruct(&oldview, &nv);
161          newimage();
162   }
163  
# Line 170 | Line 171 | char  *s;
171  
172          if (getinterest(s, 1, nv.vdir, &zfact) < 0)
173                  return;
174 +        nv.type = ourview.type;
175          VCOPY(nv.vp, ourview.vp);
176          VCOPY(nv.vup, ourview.vup);
177          nv.hoff = ourview.hoff; nv.voff = ourview.voff;
178 <        if ((nv.type = ourview.type) == VT_PAR) {
179 <                nv.horiz = ourview.horiz / zfact;
178 <                nv.vert = ourview.vert / zfact;
179 <        } else {
180 <                nv.horiz = atan(tan(ourview.horiz*(PI/180./2.))/zfact) /
181 <                                (PI/180./2.);
182 <                nv.vert = atan(tan(ourview.vert*(PI/180./2.))/zfact) /
183 <                                (PI/180./2.);
184 <        }
178 >        nv.horiz = ourview.horiz; nv.vert = ourview.vert;
179 >        zoomview(&nv, zfact);
180          newview(&nv);
181   }
182  
# Line 211 | Line 206 | char  *s;
206                  error(COMMAND, "missing angle");
207                  return;
208          }
209 +        nv.type = ourview.type;
210          VCOPY(nv.vp, ourview.vp);
211          VCOPY(nv.vup, ourview.vup);
212          nv.hoff = ourview.hoff; nv.voff = ourview.voff;
# Line 220 | Line 216 | char  *s;
216                  normalize(v1);
217                  spinvector(nv.vdir, nv.vdir, v1, elev*(PI/180.));
218          }
219 <        if ((nv.type = ourview.type) == VT_PAR) {
220 <                nv.horiz = ourview.horiz / zfact;
225 <                nv.vert = ourview.vert / zfact;
226 <        } else {
227 <                nv.horiz = atan(tan(ourview.horiz*(PI/180./2.))/zfact) /
228 <                                (PI/180./2.);
229 <                nv.vert = atan(tan(ourview.vert*(PI/180./2.))/zfact) /
230 <                                (PI/180./2.);
231 <        }
219 >        nv.horiz = ourview.horiz; nv.vert = ourview.vert;
220 >        zoomview(&nv, zfact);
221          newview(&nv);
222   }
223  
# Line 282 | Line 271 | char  *s;
271                          if (*cp == '\0') {      /* interactive */
272                                  sprintf(buf, "exposure (%lf): ", exposure);
273                                  (*dev->comout)(buf);
274 <                                (*dev->comin)(buf);
274 >                                (*dev->comin)(buf, NULL);
275                                  for (cp = buf; isspace(*cp); cp++)
276                                          ;
277                                  if (*cp == '\0')
# Line 335 | Line 324 | register char  *s;
324          
325          if (s[0] == '\0') {
326                  (*dev->comout)("aa ab ad ar as av dc dj dt lr lw sp st: ");
327 <                (*dev->comin)(buf);
327 >                (*dev->comin)(buf, NULL);
328                  s = buf;
329          }
330          switch (s[0]) {
# Line 346 | Line 335 | register char  *s;
335                                  sprintf(buf, "limit weight (%.6g): ",
336                                                  minweight);
337                                  (*dev->comout)(buf);
338 <                                (*dev->comin)(buf);
338 >                                (*dev->comin)(buf, NULL);
339                                  if (sscanf(buf, "%lf", &d0) != 1)
340                                          break;
341                          }
# Line 357 | Line 346 | register char  *s;
346                                  sprintf(buf, "limit reflection (%d): ",
347                                                  maxdepth);
348                                  (*dev->comout)(buf);
349 <                                (*dev->comin)(buf);
349 >                                (*dev->comin)(buf, NULL);
350                                  if (sscanf(buf, "%d", &i0) != 1)
351                                          break;
352                          }
# Line 374 | Line 363 | register char  *s;
363                                  sprintf(buf, "direct jitter (%.6g): ",
364                                                  dstrsrc);
365                                  (*dev->comout)(buf);
366 <                                (*dev->comin)(buf);
366 >                                (*dev->comin)(buf, NULL);
367                                  if (sscanf(buf, "%lf", &d0) != 1)
368                                          break;
369                          }
# Line 385 | Line 374 | register char  *s;
374                                  sprintf(buf, "direct certainty (%.6g): ",
375                                                  shadcert);
376                                  (*dev->comout)(buf);
377 <                                (*dev->comin)(buf);
377 >                                (*dev->comin)(buf, NULL);
378                                  if (sscanf(buf, "%lf", &d0) != 1)
379                                          break;
380                          }
# Line 396 | Line 385 | register char  *s;
385                                  sprintf(buf, "direct threshold (%.6g): ",
386                                                  shadthresh);
387                                  (*dev->comout)(buf);
388 <                                (*dev->comin)(buf);
388 >                                (*dev->comin)(buf, NULL);
389                                  if (sscanf(buf, "%lf", &d0) != 1)
390                                          break;
391                          }
# Line 416 | Line 405 | register char  *s;
405                                                  colval(ambval,GRN),
406                                                  colval(ambval,BLU));
407                                  (*dev->comout)(buf);
408 <                                (*dev->comin)(buf);
408 >                                (*dev->comin)(buf, NULL);
409                                  if (sscanf(buf, "%lf %lf %lf",
410                                                  &d0, &d1, &d2) != 3)
411                                          break;
# Line 428 | Line 417 | register char  *s;
417                                  sprintf(buf, "ambient accuracy (%.6g): ",
418                                                  ambacc);
419                                  (*dev->comout)(buf);
420 <                                (*dev->comin)(buf);
420 >                                (*dev->comin)(buf, NULL);
421                                  if (sscanf(buf, "%lf", &d0) != 1)
422                                          break;
423                          }
# Line 439 | Line 428 | register char  *s;
428                                  sprintf(buf, "ambient divisions (%d): ",
429                                                  ambdiv);
430                                  (*dev->comout)(buf);
431 <                                (*dev->comin)(buf);
431 >                                (*dev->comin)(buf, NULL);
432                                  if (sscanf(buf, "%d", &i0) != 1)
433                                          break;
434                          }
# Line 450 | Line 439 | register char  *s;
439                                  sprintf(buf, "ambient super-samples (%d): ",
440                                                  ambssamp);
441                                  (*dev->comout)(buf);
442 <                                (*dev->comin)(buf);
442 >                                (*dev->comin)(buf, NULL);
443                                  if (sscanf(buf, "%d", &i0) != 1)
444                                          break;
445                          }
# Line 461 | Line 450 | register char  *s;
450                                  sprintf(buf, "ambient bounces (%d): ",
451                                                  ambounce);
452                                  (*dev->comout)(buf);
453 <                                (*dev->comin)(buf);
453 >                                (*dev->comin)(buf, NULL);
454                                  if (sscanf(buf, "%d", &i0) != 1)
455                                          break;
456                          }
# Line 472 | Line 461 | register char  *s;
461                                  sprintf(buf, "ambient resolution (%d): ",
462                                                  ambres);
463                                  (*dev->comout)(buf);
464 <                                (*dev->comin)(buf);
464 >                                (*dev->comin)(buf, NULL);
465                                  if (sscanf(buf, "%d", &i0) != 1)
466                                          break;
467                          }
# Line 489 | Line 478 | register char  *s;
478                          if (sscanf(s+2, "%d", &i0) != 1) {
479                                  sprintf(buf, "sample pixel (%d): ", psample);
480                                  (*dev->comout)(buf);
481 <                                (*dev->comin)(buf);
481 >                                (*dev->comin)(buf, NULL);
482                                  if (sscanf(buf, "%d", &i0) != 1)
483                                          break;
484                          }
# Line 501 | Line 490 | register char  *s;
490                                  sprintf(buf, "sample threshold (%.6g): ",
491                                                  maxdiff);
492                                  (*dev->comout)(buf);
493 <                                (*dev->comin)(buf);
493 >                                (*dev->comin)(buf, NULL);
494                                  if (sscanf(buf, "%lf", &d0) != 1)
495                                          break;
496                          }
# Line 540 | Line 529 | char  *s;
529                  if ((*dev->getcur)(&x, &y) == ABORT)
530                          return;
531  
532 <                viewray(thisray.rorg, thisray.rdir, &ourview,
533 <                                (x+.5)/hresolu, (y+.5)/vresolu);
534 <                
532 >                if (viewray(thisray.rorg, thisray.rdir, &ourview,
533 >                                (x+.5)/hresolu, (y+.5)/vresolu) < 0) {
534 >                        error(COMMAND, "not on image");
535 >                        return;
536 >                }
537 >
538          } else if (normalize(thisray.rdir) == 0.0) {
539                  error(COMMAND, "zero ray direction");
540                  return;
# Line 560 | Line 552 | char  *s;
552                                  ofun[thisray.ro->otype].funame,
553                                  thisray.ro->oname);
554                  (*dev->comout)(buf);
555 <                (*dev->comin)(buf);
555 >                (*dev->comin)(buf, NULL);
556                  if (thisray.rot >= FHUGE)
557                          (*dev->comout)("at infinity");
558                  else {
# Line 568 | Line 560 | char  *s;
560                                          thisray.rop[1], thisray.rop[2]);
561                          (*dev->comout)(buf);
562                  }
563 <                (*dev->comin)(buf);
563 >                (*dev->comin)(buf, NULL);
564                  sprintf(buf, "with value (%.6g %.6g %.6g)",
565                                  colval(thisray.rcol,RED),
566                                  colval(thisray.rcol,GRN),
567                                  colval(thisray.rcol,BLU));
568                  (*dev->comout)(buf);
569          }
570 <        (*dev->comin)(buf);
570 >        (*dev->comin)(buf, NULL);
571   }
572  
573  
# Line 609 | Line 601 | char  *s;
601                  fputexpos(exposure, fp);
602          if (dev->pixaspect != 1.0)
603                  fputaspect(dev->pixaspect, fp);
604 +        fputformat(COLRFMT, fp);
605          putc('\n', fp);
606          fputresolu(YMAJOR|YDECR, hresolu, vresolu, fp);
607  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines