--- ray/src/util/rad.c 1993/05/26 11:37:42 2.9 +++ ray/src/util/rad.c 1993/08/24 20:29:22 2.19 @@ -105,6 +105,7 @@ extern long fdate(), time(); long scenedate; /* date of latest scene or object file */ long octreedate; /* date of octree */ +long matdate; /* date of latest material file */ int explicate = 0; /* explicate variables */ int silent = 0; /* do work silently */ @@ -309,7 +310,7 @@ register int n; { register char *cp; - if (vp == NULL || n < 0 || n >= vp->nass) + if (vp == NULL | n < 0 | n >= vp->nass) return(NULL); cp = vp->value; while (n--) @@ -423,6 +424,9 @@ checkfiles() /* check for existence and modified tim vnam(OCTREE), vnam(SCENE)); exit(1); } + matdate = -1; + if (vdef(MATERIAL)) + matdate = checklast(vval(MATERIAL)); } @@ -561,11 +565,12 @@ checkambfile() /* check date on ambient file */ { long afdate; - if (vdef(AMBFILE)) { - afdate = fdate(vval(AMBFILE)); - if (afdate >= 0 & octreedate > afdate) - rmfile(vval(AMBFILE)); - } + if (!vdef(AMBFILE)) + return; + if ((afdate = fdate(vval(AMBFILE))) < 0) + return; + if (octreedate > afdate | matdate > afdate) + rmfile(vval(AMBFILE)); } @@ -621,7 +626,7 @@ register char *op; op = addarg(op, "-ds .4"); else op = addarg(op, "-ds 0"); - op = addarg(op, "-dt .2 -dc .25 -dr 0 -sj 0 -st .7"); + op = addarg(op, "-dt .2 -dc .25 -dr 0 -sj 0 -st .5"); if (vdef(AMBFILE)) { sprintf(op, " -af %s", vval(AMBFILE)); op += strlen(op); @@ -629,13 +634,13 @@ register char *op; overture = 0; switch (vscale(VARIABILITY)) { case LOW: - op = addarg(op, "-aa .4 -ad 32"); + op = addarg(op, "-aa .4 -ad 64"); break; case MEDIUM: - op = addarg(op, "-aa .3 -ad 64"); + op = addarg(op, "-aa .3 -ad 128"); break; case HIGH: - op = addarg(op, "-aa .25 -ad 128"); + op = addarg(op, "-aa .25 -ad 256"); break; } op = addarg(op, "-as 0"); @@ -685,7 +690,7 @@ register char *op; op = addarg(op, "-ds .2 -dj .35"); else op = addarg(op, "-ds .3"); - op = addarg(op, "-dt .1 -dc .5 -dr 1 -sj .7 -st .15"); + op = addarg(op, "-dt .1 -dc .5 -dr 1 -sj .7 -st .1"); if (overture = vint(INDIRECT)) { sprintf(op, " -ab %d", overture); op += strlen(op); @@ -697,13 +702,13 @@ register char *op; overture = 0; switch (vscale(VARIABILITY)) { case LOW: - op = addarg(op, "-aa .25 -ad 128 -as 0"); + op = addarg(op, "-aa .25 -ad 196 -as 0"); break; case MEDIUM: - op = addarg(op, "-aa .2 -ad 300 -as 64"); + op = addarg(op, "-aa .2 -ad 400 -as 64"); break; case HIGH: - op = addarg(op, "-aa .15 -ad 500 -as 128"); + op = addarg(op, "-aa .15 -ad 768 -as 196"); break; } d = ambval(); @@ -752,7 +757,7 @@ register char *op; op = addarg(op, "-ds .1 -dj .7"); else op = addarg(op, "-ds .2"); - op = addarg(op, "-dt .05 -dc .75 -dr 3 -sj 1 -st .03"); + op = addarg(op, "-dt .05 -dc .75 -dr 3 -sj 1 -st .01"); sprintf(op, " -ab %d", overture=vint(INDIRECT)+1); op += strlen(op); if (vdef(AMBFILE)) { @@ -762,13 +767,13 @@ register char *op; overture = 0; switch (vscale(VARIABILITY)) { case LOW: - op = addarg(op, "-aa .15 -ad 200 -as 0"); + op = addarg(op, "-aa .15 -ad 256 -as 0"); break; case MEDIUM: - op = addarg(op, "-aa .125 -ad 512 -as 128"); + op = addarg(op, "-aa .125 -ad 512 -as 256"); break; case HIGH: - op = addarg(op, "-aa .08 -ad 850 -as 256"); + op = addarg(op, "-aa .08 -ad 1024 -as 512"); break; } d = ambval(); @@ -784,18 +789,22 @@ xferopts(ro) /* transfer options if indicated */ char *ro; { int fd, n; + register char *cp; n = strlen(ro); if (n < 2) return; if (vdef(OPTFILE)) { - if ((fd = open(vval(OPTFILE), O_WRONLY|O_CREAT|O_TRUNC, 0666)) == -1) + for (cp = ro; cp[1]; cp++) + if (isspace(cp[1]) && cp[2] == '-' && isalpha(cp[3])) + *cp = '\n'; + else + *cp = cp[1]; + *cp = '\n'; + fd = open(vval(OPTFILE), O_WRONLY|O_CREAT|O_TRUNC, 0666); + if (fd < 0 || write(fd, ro, n) != n || close(fd) < 0) syserr(vval(OPTFILE)); - if (write(fd, ro+1, n-1) != n-1) - syserr(vval(OPTFILE)); - write(fd, "\n", 1); - close(fd); - sprintf(ro, " \"^%s\"", vval(OPTFILE)); + sprintf(ro, " @%s", vval(OPTFILE)); } #ifdef MSDOS else if (n > 50) { @@ -814,8 +823,14 @@ register char *po; po = addarg(po, "-1 -e"); po = addarg(po, vval(EXPOSURE)); } - if (vscale(QUALITY) == HIGH) - po = addarg(po, "-r .65"); + switch (vscale(QUALITY)) { + case MEDIUM: + po = addarg(po, "-r 1"); + break; + case HIGH: + po = addarg(po, "-m .25"); + break; + } if (vdef(PFILT)) po = addarg(po, vval(PFILT)); } @@ -955,7 +970,7 @@ getview(n, vn) /* get view n, or NULL if none */ int n; char *vn; /* returned view name */ { - register char *mv = NULL; + register char *mv; if (viewselect != NULL) { /* command-line selected */ if (n) /* only do one */ @@ -970,6 +985,9 @@ char *vn; /* returned view name */ ; *vn = '\0'; } + /* view number? */ + if (isdigit(viewselect[0])) + return(specview(nvalue(vv+VIEW, atoi(viewselect)-1))); /* check list */ while ((mv = nvalue(vv+VIEW, n++)) != NULL) if (matchword(viewselect, mv)) @@ -978,9 +996,10 @@ char *vn; /* returned view name */ } mv = nvalue(vv+VIEW, n); /* use view n */ if (vn != NULL & mv != NULL) { - if (*mv != '-') - while (*mv && !isspace(*mv)) - *vn++ = *mv++; + register char *mv2 = mv; + if (*mv2 != '-') + while (*mv2 && !isspace(*mv2)) + *vn++ = *mv2++; *vn = '\0'; } return(specview(mv)); @@ -1011,6 +1030,7 @@ char *opts; char pfopts[128]; char vs[32], *vw; int vn, mult; + long lastdate; /* get pfilt options */ pfiltopts(pfopts); /* get resolution, reporting */ @@ -1041,6 +1061,8 @@ char *opts; else badvalue(REPORT); } + /* get update time */ + lastdate = octreedate > matdate ? octreedate : matdate; /* do each view */ vn = 0; while ((vw = getview(vn++, vs)) != NULL) { @@ -1048,11 +1070,11 @@ char *opts; sprintf(vs, "%d", vn); sprintf(picfile, "%s_%s.pic", vval(PICTURE), vs); /* check date on picture */ - if (fdate(picfile) > octreedate) + if (fdate(picfile) >= lastdate) continue; /* build rpict command */ sprintf(rawfile, "%s_%s.raw", vval(PICTURE), vs); - if (fdate(rawfile) > octreedate) /* recover */ + if (fdate(rawfile) >= octreedate) /* recover */ sprintf(combuf, "rpict%s%s -ro %s %s", rep, opts, rawfile, vval(OCTREE)); else {