ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/rad.c
(Generate patch)

Comparing ray/src/util/rad.c (file contents):
Revision 2.19 by greg, Tue Aug 24 20:29:22 1993 UTC vs.
Revision 2.21 by greg, Tue Aug 24 22:14:21 1993 UTC

# Line 110 | Line 110 | long   matdate;                /* date of latest material file */
110   int     explicate = 0;          /* explicate variables */
111   int     silent = 0;             /* do work silently */
112   int     noaction = 0;           /* don't do anything */
113 + int     sayview = 0;            /* print view out */
114   char    *rvdevice = NULL;       /* rview output device */
115   char    *viewselect = NULL;     /* specific view only */
116  
# Line 143 | Line 144 | char   *argv[];
144                  case 'o':
145                          rvdevice = argv[++i];
146                          break;
147 +                case 'V':
148 +                        sayview++;
149 +                        break;
150                  case 'v':
151                          viewselect = argv[++i];
152                          break;
# Line 578 | Line 582 | double
582   ambval()                                /* compute ambient value */
583   {
584          if (vdef(EXPOSURE)) {
585 +                if (!isflt(vval(EXPOSURE)))
586 +                        badvalue(EXPOSURE);
587                  if (vval(EXPOSURE)[0] == '+' || vval(EXPOSURE)[0] == '-')
588                          return(.5/pow(2.,atof(vval(EXPOSURE))));
589 <                if (isdigit(vval(EXPOSURE)[0]) || vval(EXPOSURE)[0] == '.')
584 <                        return(.5/atof(vval(EXPOSURE)));
585 <                badvalue(EXPOSURE);
589 >                return(.5/atof(vval(EXPOSURE)));
590          }
591          if (vlet(ZONE) == 'E')
592                  return(10.);
# Line 986 | Line 990 | char   *vn;            /* returned view name */
990                          *vn = '\0';
991                  }
992                                                  /* view number? */
993 <                if (isdigit(viewselect[0]))
993 >                if (isint(viewselect))
994                          return(specview(nvalue(vv+VIEW, atoi(viewselect)-1)));
995                                                  /* check list */
996                  while ((mv = nvalue(vv+VIEW, n++)) != NULL)
# Line 1006 | Line 1010 | char   *vn;            /* returned view name */
1010   }
1011  
1012  
1013 + printview(vopts)                        /* print out selected view */
1014 + register char   *vopts;
1015 + {
1016 +        extern char     *atos();
1017 +        char    buf[256];
1018 +        FILE    *fp;
1019 +        register char   *cp;
1020 +
1021 +        if (vopts == NULL)
1022 +                return(-1);
1023 +        fputs("VIEW=", stdout);
1024 +        do {
1025 +                if (matchword(vopts, "-vf")) {          /* expand view file */
1026 +                        vopts = sskip(vopts);
1027 +                        if (!*atos(buf, sizeof(buf), vopts))
1028 +                                return(-1);
1029 +                        if ((fp = fopen(buf, "r")) == NULL)
1030 +                                return(-1);
1031 +                        for (buf[sizeof(buf)-2] = '\n';
1032 +                                        fgets(buf, sizeof(buf), fp) != NULL &&
1033 +                                                buf[0] != '\n';
1034 +                                        buf[sizeof(buf)-2] = '\n') {
1035 +                                if (buf[sizeof(buf)-2] != '\n') {
1036 +                                        ungetc(buf[sizeof(buf)-2], fp);
1037 +                                        buf[sizeof(buf)-2] = '\0';
1038 +                                }
1039 +                                if (matchword(buf, "VIEW=") ||
1040 +                                                matchword(buf, "rview")) {
1041 +                                        for (cp = sskip(buf); *cp && *cp != '\n'; cp++)
1042 +                                                putchar(*cp);
1043 +                                }
1044 +                        }
1045 +                        fclose(fp);
1046 +                        vopts = sskip(vopts);
1047 +                } else {
1048 +                        while (isspace(*vopts))
1049 +                                vopts++;
1050 +                        putchar(' ');
1051 +                        while (*vopts && !isspace(*vopts))
1052 +                                putchar(*vopts++);
1053 +                }
1054 +        } while (*vopts++);
1055 +        putchar('\n');
1056 +        return(0);
1057 + }
1058 +
1059 +
1060   rview(opts)                             /* run rview with first view */
1061   char    *opts;
1062   {
1063 +        char    *vw;
1064          char    combuf[512];
1065                                          /* build command */
1066 <        sprintf(combuf, "rview %s%s ", getview(0, NULL), opts);
1066 >        if ((vw = getview(0, NULL)) == NULL)
1067 >                return;
1068 >        if (sayview)
1069 >                printview(vw);
1070 >        sprintf(combuf, "rview %s%s ", vw, opts);
1071          if (rvdevice != NULL)
1072                  sprintf(combuf+strlen(combuf), "-o %s ", rvdevice);
1073          strcat(combuf, vval(OCTREE));
# Line 1066 | Line 1122 | char   *opts;
1122                                          /* do each view */
1123          vn = 0;
1124          while ((vw = getview(vn++, vs)) != NULL) {
1125 +                if (sayview)
1126 +                        printview(vw);
1127                  if (!vs[0])
1128                          sprintf(vs, "%d", vn);
1129                  sprintf(picfile, "%s_%s.pic", vval(PICTURE), vs);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines