--- ray/src/util/rad.c 1993/03/12 13:37:03 2.4 +++ ray/src/util/rad.c 1993/04/06 17:21:04 2.7 @@ -94,6 +94,13 @@ int (*setqopts[3])() = {lowqopts, medqopts, hiqopts}; #define renderopts (*setqopts[vscale(QUALITY)]) + /* overture calculation file */ +#ifdef NIX +char overfile[] = "overture.raw"; +#else +char overfile[] = "/dev/null"; +#endif + extern long fdate(), time(); long scenedate; /* date of latest scene or object file */ @@ -159,8 +166,11 @@ char *argv[]; /* print all values if requested */ if (explicate) printvals(); - /* run simulation */ + /* build octree */ oconv(); + /* check date on ambient file */ + checkambfile(); + /* run simulation */ renderopts(ropts); xferopts(ropts); if (rvdevice != NULL) @@ -547,6 +557,18 @@ register char *oo; } +checkambfile() /* check date on ambient file */ +{ + long afdate; + + if (vdef(AMBFILE)) { + afdate = fdate(vval(AMBFILE)); + if (afdate >= 0 & octreedate > afdate) + rmfile(vval(AMBFILE)); + } +} + + double ambval() /* compute ambient value */ { @@ -664,8 +686,10 @@ register char *op; else op = addarg(op, "-ds .3"); op = addarg(op, "-dt .1 -dc .5 -dr 1 -sj .7 -st .15"); - sprintf(op, " -ab %d", overture=vint(INDIRECT)); - op += strlen(op); + if (overture = vint(INDIRECT)) { + sprintf(op, " -ab %d", overture); + op += strlen(op); + } if (vdef(AMBFILE)) { sprintf(op, " -af %s", vval(AMBFILE)); op += strlen(op); @@ -1020,12 +1044,6 @@ char *opts; else badvalue(REPORT); } - /* check date on ambient file */ - if (vdef(AMBFILE)) { - long afdate = fdate(vval(AMBFILE)); - if (afdate >= 0 & octreedate > afdate) - rmfile(vval(AMBFILE)); - } /* do each view */ vn = 0; while ((vw = getview(vn++, vs)) != NULL) { @@ -1045,14 +1063,16 @@ char *opts; sprintf(combuf, "rpict%s %s%s -x 64 -y 64 -ps 1 %s > %s", rep, vw, opts, - vval(OCTREE), rawfile); + vval(OCTREE), overfile); if (runcom(combuf)) { fprintf(stderr, - "%s: error in overture for view %s\n\t%s removed\n", - progname, vs, rawfile); - unlink(rawfile); + "%s: error in overture for view %s\n", + progname, vs); exit(1); } +#ifdef NIX + rmfile(overfile); +#endif } sprintf(combuf, "rpict%s %s %s%s %s > %s", rep, vw, res, opts,