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.126 by greg, Tue Feb 26 23:31:11 2019 UTC vs.
Revision 2.134 by greg, Tue Jun 3 21:31:51 2025 UTC

# Line 64 | Line 64 | static const char      RCSid[] = "$Id$";
64   int NVARS = 31;
65  
66   VARIABLE        vv[] = {                /* variable-value pairs */
67 <        {"AMBFILE",     3,      0,      NULL,   onevalue},
67 >        {"AMBFILE",     3,      0,      NULL,   strvalue},
68          {"DETAIL",      3,      0,      NULL,   qualvalue},
69          {"EXPOSURE",    3,      0,      NULL,   fltvalue},
70          {"EYESEP",      3,      0,      NULL,   fltvalue},
# Line 75 | Line 75 | VARIABLE       vv[] = {                /* variable-value pairs */
75          {"mkpmap",      3,      0,      NULL,   catvalues},
76          {"objects",     3,      0,      NULL,   catvalues},
77          {"oconv",       3,      0,      NULL,   catvalues},
78 <        {"OCTREE",      3,      0,      NULL,   onevalue},
79 <        {"OPTFILE",     3,      0,      NULL,   onevalue},
80 <        {"PCMAP",       2,      0,      NULL,   onevalue},
78 >        {"OCTREE",      3,      0,      NULL,   strvalue},
79 >        {"OPTFILE",     3,      0,      NULL,   strvalue},
80 >        {"PCMAP",       2,      0,      NULL,   strvalue},
81          {"PENUMBRAS",   3,      0,      NULL,   boolvalue},
82          {"pfilt",       2,      0,      NULL,   catvalues},
83 <        {"PGMAP",       2,      0,      NULL,   onevalue},
84 <        {"PICTURE",     3,      0,      NULL,   onevalue},
83 >        {"PGMAP",       2,      0,      NULL,   strvalue},
84 >        {"PICTURE",     3,      0,      NULL,   strvalue},
85          {"QUALITY",     3,      0,      NULL,   qualvalue},
86 <        {"RAWFILE",     3,      0,      NULL,   onevalue},
86 >        {"RAWFILE",     3,      0,      NULL,   strvalue},
87          {"render",      3,      0,      NULL,   catvalues},
88          {"REPORT",      3,      0,      NULL,   onevalue},
89          {"RESOLUTION",  3,      0,      NULL,   onevalue},
# Line 93 | Line 93 | VARIABLE       vv[] = {                /* variable-value pairs */
93          {"UP",          2,      0,      NULL,   onevalue},
94          {"VARIABILITY", 3,      0,      NULL,   qualvalue},
95          {"view",        2,      0,      NULL,   NULL},
96 <        {"ZFILE",       2,      0,      NULL,   onevalue},
96 >        {"ZFILE",       2,      0,      NULL,   strvalue},
97          {"ZONE",        2,      0,      NULL,   onevalue},
98   };
99  
# Line 131 | Line 131 | char   *viewselect = NULL;     /* specific view only */
131  
132   #define DEF_RPICT_PATH  "rpict"         /* default rpict path */
133  
134 + #define R_CMDMAX        (5*PATH_MAX+512)
135                                  /* command paths */
136   char    c_oconv[256] = "oconv";
137   char    c_mkillum[256] = "mkillum";
# Line 144 | Line 145 | int    overture = 0;           /* overture calculation needed */
145  
146   int     children_running = 0;   /* set negative in children */
147  
147 char    *progname;              /* global argv[0] */
148   char    *rifname;               /* global rad input file name */
149  
150   char    radname[PATH_MAX];      /* root Radiance file name */
# Line 197 | Line 197 | main(
197          char    ropts[512];
198          char    popts[64];
199          int     i;
200 <
201 <        progname = argv[0];
200 >                                /* set global progname */
201 >        fixargv0(argv[0]);
202                                  /* get options */
203          for (i = 1; i < argc && argv[i][0] == '-'; i++)
204                  switch (argv[i][1]) {
# Line 242 | Line 242 | main(
242                                  /* load variable values */
243          loadvars(rifname);
244                                  /* get any additional assignments */
245 <        for (i++; i < argc; i++)
246 <                if (setvariable(argv[i], matchvar) < 0) {
247 <                        fprintf(stderr, "%s: unknown variable: %s\n",
245 >        for (i++; i < argc; i++) {
246 >                int     rv = setvariable(argv[i], matchvar);
247 >                if (rv < 0) {
248 >                        fprintf(stderr, "%s: unknown setting: %s\n",
249                                          progname, argv[i]);
250                          quit(1);
251                  }
252 +                if (!rv)
253 +                        fprintf(stderr,
254 +                        "%s: bad variable assignment: %s (ignored)\n",
255 +                                        progname, argv[i]);
256 +        }
257                                  /* check assignments */
258          checkvalues();
259                                  /* check files and dates */
# Line 522 | Line 528 | static void
528   oconv(void)                             /* run oconv and mkillum if necessary */
529   {
530          static char     illumtmp[] = "ilXXXXXX";
531 <        char    combuf[PATH_MAX], ocopts[64], mkopts[1024];
531 >        char    combuf[R_CMDMAX], ocopts[64], mkopts[1024];
532  
533          oconvopts(ocopts);              /* get options */
534          if (octreedate < scenedate) {   /* check date on original octree */
# Line 790 | Line 796 | ambval(void)                           /* compute ambient value */
796   {
797          if (vdef(EXPOSURE)) {
798                  if (vval(EXPOSURE)[0] == '+' || vval(EXPOSURE)[0] == '-')
799 <                        return(.5/pow(2.,vflt(EXPOSURE)));
800 <                return(.5/vflt(EXPOSURE));
799 >                        return(.18/pow(2.,vflt(EXPOSURE)));
800 >                return(.18/vflt(EXPOSURE));
801          }
802          if (vlet(ZONE) == 'E')
803                  return(10.);
# Line 834 | Line 840 | renderopts(                    /* set rendering options */
840                  op = addarg(addarg(op, "-ap"), pmapf);
841                  if (atoi(bw) > 0) op = addarg(op, bw);
842          }
843 <        if (vdef(RENDER))
843 >        if (vdef(RENDER)) {
844                  op = addarg(op, vval(RENDER));
845 +                bw = strstr(vval(RENDER), "-aa ");
846 +                if (bw != NULL && atof(bw+4) <= FTINY)
847 +                        overture = 0;
848 +        }
849          if (rvdevice != NULL) {
850                  if (vdef(RVU)) {
851                          if (vval(RVU)[0] != '-') {
# Line 920 | Line 930 | lowqopts(                      /* low quality rendering options */
930          d = ambval();
931          sprintf(op, " -av %.2g %.2g %.2g", d, d, d);
932          op += strlen(op);
933 <        op = addarg(op, "-lr 6 -lw .003");
933 >        op = addarg(op, "-lr 6 -lw .001");
934   }
935  
936  
# Line 1074 | Line 1084 | hiqopts(                               /* high quality rendering options */
1084          d = ambval();
1085          sprintf(op, " -av %.2g %.2g %.2g", d, d, d);
1086          op += strlen(op);
1087 <        op = addarg(op, "-lr 12 -lw 1e-5");
1087 >        op = addarg(op, "-lr 12 -lw 5e-6");
1088   }
1089  
1090  
# Line 1405 | Line 1415 | rvu(                           /* run rvu with first view */
1415   )
1416   {
1417          char    *vw;
1418 <        char    combuf[PATH_MAX];
1418 >        char    combuf[R_CMDMAX];
1419                                          /* build command */
1420          if (touchonly || (vw = getview(0, NULL)) == NULL)
1421                  return;
# Line 1603 | Line 1613 | rpict(                         /* run rpict and pfilt for each view */
1613                  } else {
1614                          if (overture) {         /* run overture calculation */
1615                                  sprintf(combuf,
1616 <                                        "%s%s %s%s -x 64 -y 64 -ps 1 %s > %s",
1617 <                                                c_rpict, rep, vw, opts,
1616 >                                        "%s%s %s%s%s -x 64 -y 64 -ps 1 %s > %s",
1617 >                                                c_rpict, rep, vw, opts, po,
1618                                                  oct1name, overfile);
1619                                  if (!do_rpiece || !next_process(0)) {
1620                                          if (runcom(combuf)) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines