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.12 by greg, Fri Jun 25 17:35:49 1993 UTC vs.
Revision 2.20 by greg, Tue Aug 24 21:44:55 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     vwonly = 0;             /* print view only */
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 +                        vwonly++;
149 +                /* fall through */
150                  case 'v':
151                          viewselect = argv[++i];
152                          break;
# Line 167 | Line 171 | char   *argv[];
171                                  /* print all values if requested */
172          if (explicate)
173                  printvals();
174 +                                /* print view and exit? */
175 +        if (vwonly)
176 +                exit(printview()==0 ? 0 : 1);
177                                  /* build octree */
178          oconv();
179                                  /* check date on ambient file */
# Line 310 | Line 317 | register int   n;
317   {
318          register char   *cp;
319  
320 <        if (vp == NULL || n < 0 || n >= vp->nass)
320 >        if (vp == NULL | n < 0 | n >= vp->nass)
321                  return(NULL);
322          cp = vp->value;
323          while (n--)
# Line 578 | Line 585 | double
585   ambval()                                /* compute ambient value */
586   {
587          if (vdef(EXPOSURE)) {
588 +                if (!isflt(vval(EXPOSURE)))
589 +                        badvalue(EXPOSURE);
590                  if (vval(EXPOSURE)[0] == '+' || vval(EXPOSURE)[0] == '-')
591                          return(.5/pow(2.,atof(vval(EXPOSURE))));
592 <                if (isdigit(vval(EXPOSURE)[0]) || vval(EXPOSURE)[0] == '.')
584 <                        return(.5/atof(vval(EXPOSURE)));
585 <                badvalue(EXPOSURE);
592 >                return(.5/atof(vval(EXPOSURE)));
593          }
594          if (vlet(ZONE) == 'E')
595                  return(10.);
# Line 626 | Line 633 | register char  *op;
633                  op = addarg(op, "-ds .4");
634          else
635                  op = addarg(op, "-ds 0");
636 <        op = addarg(op, "-dt .2 -dc .25 -dr 0 -sj 0 -st .7");
636 >        op = addarg(op, "-dt .2 -dc .25 -dr 0 -sj 0 -st .5");
637          if (vdef(AMBFILE)) {
638                  sprintf(op, " -af %s", vval(AMBFILE));
639                  op += strlen(op);
# Line 634 | Line 641 | register char  *op;
641                  overture = 0;
642          switch (vscale(VARIABILITY)) {
643          case LOW:
644 <                op = addarg(op, "-aa .4 -ad 32");
644 >                op = addarg(op, "-aa .4 -ad 64");
645                  break;
646          case MEDIUM:
647 <                op = addarg(op, "-aa .3 -ad 64");
647 >                op = addarg(op, "-aa .3 -ad 128");
648                  break;
649          case HIGH:
650 <                op = addarg(op, "-aa .25 -ad 128");
650 >                op = addarg(op, "-aa .25 -ad 256");
651                  break;
652          }
653          op = addarg(op, "-as 0");
# Line 690 | Line 697 | register char  *op;
697                  op = addarg(op, "-ds .2 -dj .35");
698          else
699                  op = addarg(op, "-ds .3");
700 <        op = addarg(op, "-dt .1 -dc .5 -dr 1 -sj .7 -st .15");
700 >        op = addarg(op, "-dt .1 -dc .5 -dr 1 -sj .7 -st .1");
701          if (overture = vint(INDIRECT)) {
702                  sprintf(op, " -ab %d", overture);
703                  op += strlen(op);
# Line 702 | Line 709 | register char  *op;
709                  overture = 0;
710          switch (vscale(VARIABILITY)) {
711          case LOW:
712 <                op = addarg(op, "-aa .25 -ad 128 -as 0");
712 >                op = addarg(op, "-aa .25 -ad 196 -as 0");
713                  break;
714          case MEDIUM:
715 <                op = addarg(op, "-aa .2 -ad 300 -as 64");
715 >                op = addarg(op, "-aa .2 -ad 400 -as 64");
716                  break;
717          case HIGH:
718 <                op = addarg(op, "-aa .15 -ad 500 -as 128");
718 >                op = addarg(op, "-aa .15 -ad 768 -as 196");
719                  break;
720          }
721          d = ambval();
# Line 757 | Line 764 | register char  *op;
764                  op = addarg(op, "-ds .1 -dj .7");
765          else
766                  op = addarg(op, "-ds .2");
767 <        op = addarg(op, "-dt .05 -dc .75 -dr 3 -sj 1 -st .03");
767 >        op = addarg(op, "-dt .05 -dc .75 -dr 3 -sj 1 -st .01");
768          sprintf(op, " -ab %d", overture=vint(INDIRECT)+1);
769          op += strlen(op);
770          if (vdef(AMBFILE)) {
# Line 767 | Line 774 | register char  *op;
774                  overture = 0;
775          switch (vscale(VARIABILITY)) {
776          case LOW:
777 <                op = addarg(op, "-aa .15 -ad 200 -as 0");
777 >                op = addarg(op, "-aa .15 -ad 256 -as 0");
778                  break;
779          case MEDIUM:
780 <                op = addarg(op, "-aa .125 -ad 512 -as 128");
780 >                op = addarg(op, "-aa .125 -ad 512 -as 256");
781                  break;
782          case HIGH:
783 <                op = addarg(op, "-aa .08 -ad 850 -as 256");
783 >                op = addarg(op, "-aa .08 -ad 1024 -as 512");
784                  break;
785          }
786          d = ambval();
# Line 804 | Line 811 | char   *ro;
811                  fd = open(vval(OPTFILE), O_WRONLY|O_CREAT|O_TRUNC, 0666);
812                  if (fd < 0 || write(fd, ro, n) != n || close(fd) < 0)
813                          syserr(vval(OPTFILE));
814 <                sprintf(ro, " \"^%s\"", vval(OPTFILE));
814 >                sprintf(ro, " @%s", vval(OPTFILE));
815          }
816   #ifdef MSDOS
817          else if (n > 50) {
# Line 828 | Line 835 | register char  *po;
835                  po = addarg(po, "-r 1");
836                  break;
837          case HIGH:
838 <                po = addarg(po, "-m .15");
838 >                po = addarg(po, "-m .25");
839                  break;
840          }
841          if (vdef(PFILT))
# Line 970 | Line 977 | getview(n, vn)                         /* get view n, or NULL if none */
977   int     n;
978   char    *vn;            /* returned view name */
979   {
980 <        register char   *mv = NULL;
980 >        register char   *mv;
981  
982          if (viewselect != NULL) {               /* command-line selected */
983                  if (n)                          /* only do one */
# Line 985 | Line 992 | char   *vn;            /* returned view name */
992                                  ;
993                          *vn = '\0';
994                  }
995 +                                                /* view number? */
996 +                if (isint(viewselect))
997 +                        return(specview(nvalue(vv+VIEW, atoi(viewselect)-1)));
998                                                  /* check list */
999                  while ((mv = nvalue(vv+VIEW, n++)) != NULL)
1000                          if (matchword(viewselect, mv))
# Line 993 | Line 1003 | char   *vn;            /* returned view name */
1003          }
1004          mv = nvalue(vv+VIEW, n);                /* use view n */
1005          if (vn != NULL & mv != NULL) {
1006 <                if (*mv != '-')
1007 <                        while (*mv && !isspace(*mv))
1008 <                                *vn++ = *mv++;
1006 >                register char   *mv2 = mv;
1007 >                if (*mv2 != '-')
1008 >                        while (*mv2 && !isspace(*mv2))
1009 >                                *vn++ = *mv2++;
1010                  *vn = '\0';
1011          }
1012          return(specview(mv));
1013   }
1014  
1015  
1016 + printview()                     /* print out selected view */
1017 + {
1018 +        extern char     *atos();
1019 +        char    buf[256];
1020 +        FILE    *fp;
1021 +        register char   *vopts, *cp;
1022 +
1023 +        vopts = getview(0, NULL);
1024 +        if (vopts == NULL)
1025 +                return(-1);
1026 +        fputs("VIEW=", stdout);
1027 +        do {
1028 +                if (matchword(vopts, "-vf")) {          /* expand view file */
1029 +                        vopts = sskip(vopts);
1030 +                        if (!*atos(buf, sizeof(buf), vopts))
1031 +                                return(-1);
1032 +                        if ((fp = fopen(buf, "r")) == NULL)
1033 +                                return(-1);
1034 +                        for (buf[sizeof(buf)-2] = '\n';
1035 +                                        fgets(buf, sizeof(buf), fp) != NULL &&
1036 +                                                buf[0] != '\n';
1037 +                                        buf[sizeof(buf)-2] = '\n') {
1038 +                                if (buf[sizeof(buf)-2] != '\n') {
1039 +                                        ungetc(buf[sizeof(buf)-2], fp);
1040 +                                        buf[sizeof(buf)-2] = '\0';
1041 +                                }
1042 +                                if (matchword(buf, "VIEW=") ||
1043 +                                                matchword(buf, "rview")) {
1044 +                                        for (cp = sskip(buf); *cp && *cp != '\n'; cp++)
1045 +                                                putchar(*cp);
1046 +                                }
1047 +                        }
1048 +                        fclose(fp);
1049 +                        vopts = sskip(vopts);
1050 +                } else {
1051 +                        while (isspace(*vopts))
1052 +                                vopts++;
1053 +                        putchar(' ');
1054 +                        while (*vopts && !isspace(*vopts))
1055 +                                putchar(*vopts++);
1056 +                }
1057 +        } while (*vopts++);
1058 +        putchar('\n');
1059 +        return(0);
1060 + }
1061 +
1062 +
1063   rview(opts)                             /* run rview with first view */
1064   char    *opts;
1065   {
# Line 1026 | Line 1084 | char   *opts;
1084          char    pfopts[128];
1085          char    vs[32], *vw;
1086          int     vn, mult;
1087 +        long    lastdate;
1088                                          /* get pfilt options */
1089          pfiltopts(pfopts);
1090                                          /* get resolution, reporting */
# Line 1056 | Line 1115 | char   *opts;
1115                  else
1116                          badvalue(REPORT);
1117          }
1118 +                                        /* get update time */
1119 +        lastdate = octreedate > matdate ? octreedate : matdate;
1120                                          /* do each view */
1121          vn = 0;
1122          while ((vw = getview(vn++, vs)) != NULL) {
# Line 1063 | Line 1124 | char   *opts;
1124                          sprintf(vs, "%d", vn);
1125                  sprintf(picfile, "%s_%s.pic", vval(PICTURE), vs);
1126                                                  /* check date on picture */
1127 <                if (fdate(picfile) >= octreedate)
1127 >                if (fdate(picfile) >= lastdate)
1128                          continue;
1129                                                  /* build rpict command */
1130                  sprintf(rawfile, "%s_%s.raw", vval(PICTURE), vs);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines