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.18 by greg, Wed Aug 25 14:13:51 1993 UTC vs.
Revision 2.26 by greg, Tue Dec 20 20:18:37 1994 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1993 Regents of the University of California */
1 > /* Copyright (c) 1994 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 32 | Line 32 | static char SCCSid[] = "$SunId$ LBL";
32  
33   extern char  *atos();
34  
35 < extern char  rifname[];                 /* rad input file name */
35 > extern FILE  *popen();
36  
37 + extern char  rifname[128];              /* rad input file name */
38 +
39   extern char  VersionID[];
40   extern char  *progname;
41   extern char  *octname;
# Line 138 | Line 140 | char  *s;
140          else {
141                  nv.horiz = ourview.horiz; nv.vert = ourview.vert;
142          }
143 +        sprintf(buf, "fore and aft clipping plane (%.6g %.6g): ",
144 +                        ourview.vfore, ourview.vaft);
145 +        (*dev->comout)(buf);
146 +        (*dev->comin)(buf, NULL);
147 +        if (buf[0] == CTRL('C')) return;
148 +        if (sscanf(buf, "%lf %lf", &nv.vfore, &nv.vaft) == 2)
149 +                change++;
150 +        else {
151 +                nv.vfore = ourview.vfore; nv.vaft = ourview.vaft;
152 +        }
153          sprintf(buf, "view shift and lift (%.6g %.6g): ",
154                          ourview.hoff, ourview.voff);
155          (*dev->comout)(buf);
# Line 163 | Line 175 | char  *s;
175  
176          if (sscanf(s, "%s", buf) == 1) {        /* get parameters from a file */
177                  copystruct(&nv, &stdview);
178 <                if ((fname = getpath(buf, NULL, 0)) == NULL ||
178 >                if ((fname = getpath(buf, "", R_OK)) == NULL ||
179                                  (success = viewfile(fname, &nv, NULL)) == -1) {
180                          sprintf(errmsg, "cannot open \"%s\"", buf);
181                          error(COMMAND, errmsg);
# Line 193 | Line 205 | char  *s;
205          char  *fname;
206          FILE  *fp;
207  
208 <        if (*atos(view, sizeof(view), s))
208 >        if (*atos(view, sizeof(view), s)) {
209 >                if (isint(view)) {
210 >                        error(COMMAND, "cannot write view by number");
211 >                        return;
212 >                }
213                  s = sskip(s);
214 <        if (sscanf(s, "%s", rifname) != 1 && rifname[0] == '\0') {
214 >        }
215 >        while (isspace(*s))
216 >                s++;
217 >        if (*s)
218 >                atos(rifname, sizeof(rifname), s);
219 >        else if (rifname[0] == '\0') {
220                  error(COMMAND, "no previous rad file");
221                  return;
222          }
# Line 226 | Line 247 | char  *s;
247                  s = sskip(s);
248          else
249                  strcat(buf, "1");
250 <        if (sscanf(s, "%s", rifname) != 1 && rifname[0] == '\0') {
250 >        if (*s)
251 >                atos(rifname, sizeof(rifname), s);
252 >        else if (rifname[0] == '\0') {
253                  error(COMMAND, "no previous rad file");
254                  return;
255          }
256 <        fname = getpath(rifname, NULL, 0);
234 <        if (fname == NULL || access(fname, R_OK) == -1) {
256 >        if ((fname = getpath(rifname, "", R_OK)) == NULL) {
257                  sprintf(errmsg, "cannot access \"%s\"", rifname);
258                  error(COMMAND, errmsg);
259                  return;
# Line 338 | Line 360 | char  *s;
360          register PNODE  *p = &ptrunk;
361          int  adapt = 0;
362          double  e = 1.0;
363 < start:
363 >
364          for (cp = s; isspace(*cp); cp++)
365                  ;
366          if (*cp == '@') {
367                  adapt++;
368 <                goto start;
368 >                while (isspace(*++cp))
369 >                        ;
370          }
371          if (*cp == '\0') {              /* normalize to point */
372                  if (dev->getcur == NULL)
# Line 597 | Line 620 | char  *s;
620          int  x, y;
621          RAY  thisray;
622  
623 +        thisray.rmax = 0.0;
624 +
625          if (!sscanvec(s, thisray.rorg) ||
626                          !sscanvec(sskip(sskip(sskip(s))), thisray.rdir)) {
627  
# Line 606 | Line 631 | char  *s;
631                  if ((*dev->getcur)(&x, &y) == ABORT)
632                          return;
633  
634 <                if (viewray(thisray.rorg, thisray.rdir, &ourview,
635 <                                (x+.5)/hresolu, (y+.5)/vresolu) < 0) {
634 >                if ((thisray.rmax = viewray(thisray.rorg, thisray.rdir,
635 >                        &ourview, (x+.5)/hresolu, (y+.5)/vresolu)) < -FTINY) {
636                          error(COMMAND, "not on image");
637                          return;
638                  }
# Line 624 | Line 649 | char  *s;
649          if (thisray.ro == NULL)
650                  (*dev->comout)("ray hit nothing");
651          else {
652 <                sprintf(buf, "ray hit %s %s \"%s\"",
653 <                                objptr(thisray.ro->omod)->oname,
652 >                sprintf(buf, "ray hit %s%s %s \"%s\"",
653 >                                thisray.rod < 0.0 ? "back of " : "",
654 >                                thisray.ro->omod == OVOID ? VOIDID :
655 >                                        objptr(thisray.ro->omod)->oname,
656                                  ofun[thisray.ro->otype].funame,
657                                  thisray.ro->oname);
658                  (*dev->comout)(buf);
# Line 658 | Line 685 | char  *s;
685          COLR  *scanline;
686          int  y;
687  
688 <        if (sscanf(s, "%s", buf) != 1 && buf[0] == '\0') {
688 >        while (isspace(*s))
689 >                s++;
690 >        if (*s)
691 >                atos(buf, sizeof(buf), s);
692 >        else if (buf[0] == '\0') {
693                  error(COMMAND, "no file");
694                  return;
695          }
# Line 675 | Line 706 | char  *s;
706          (*dev->comout)(fname);
707          (*dev->comout)("\"...\n");
708                                                  /* write header */
709 +        newheader("RADIANCE", fp);
710          fputs(progname, fp);
711          fprintview(&ourview, fp);
712          if (octname != NULL)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines