--- ray/src/util/rad.c 2011/01/29 16:44:20 2.104 +++ ray/src/util/rad.c 2013/08/12 21:01:00 2.108 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: rad.c,v 2.104 2011/01/29 16:44:20 greg Exp $"; +static const char RCSid[] = "$Id: rad.c,v 2.108 2013/08/12 21:01:00 greg Exp $"; #endif /* * Executive program for oconv, rpict and pfilt @@ -558,6 +558,7 @@ oconv(void) /* run oconv and mkillum if necessary * unlink(illumtmp); quit(1); } + rmfile(oct0name); /* make octree1 (frozen) */ if (octreedate) sprintf(combuf, "%s%s -f -i %s %s > %s", c_oconv, @@ -772,7 +773,7 @@ lowqopts( /* low quality rendering options */ d = ambval(); sprintf(op, " -av %.2g %.2g %.2g", d, d, d); op += strlen(op); - op = addarg(op, "-lr 6 -lw .01"); + op = addarg(op, "-lr 6 -lw .003"); } @@ -850,7 +851,7 @@ medqopts( /* medium quality rendering options */ d = ambval(); sprintf(op, " -av %.2g %.2g %.2g", d, d, d); op += strlen(op); - op = addarg(op, "-lr 8 -lw .002"); + op = addarg(op, "-lr 8 -lw 1e-4"); } @@ -926,7 +927,7 @@ hiqopts( /* high quality rendering options */ d = ambval(); sprintf(op, " -av %.2g %.2g %.2g", d, d, d); op += strlen(op); - op = addarg(op, "-lr 12 -lw .0005"); + op = addarg(op, "-lr 12 -lw 1e-5"); } @@ -1254,6 +1255,32 @@ rvu( /* run rvu with first view */ } +static int +syncf_done( /* check if an rpiece sync file is complete */ + char *sfname +) +{ + FILE *fp = fopen(sfname, "r"); + int todo = 1; + int x, y; + + if (fp == NULL) + return(0); + if (fscanf(fp, "%d %d", &x, &y) != 2) + goto checked; + todo = x*y; /* total number of tiles */ + if (fscanf(fp, "%d %d", &x, &y) != 2 || (x != 0) | (y != 0)) + goto checked; + /* XXX assume no redundant tiles */ + while (fscanf(fp, "%d %d", &x, &y) == 2) + if (!--todo) + break; +checked: + fclose(fp); + return(!todo); +} + + static void rpict( /* run rpict and pfilt for each view */ char *opts, @@ -1361,7 +1388,7 @@ rpict( /* run rpict and pfilt for each view */ int xdiv = 8+nprocs/3, ydiv = 8+nprocs/3; if (rfdt >= oct1date) { fprintf(stderr, - "%s: partial output not created with rpiece\n", rawfile); + "%s: partial output not created with %s\n", rawfile, c_rpiece); quit(1); } if (rfdt) { /* start fresh */ @@ -1450,7 +1477,12 @@ rpict( /* run rpict and pfilt for each view */ if (do_rpiece) { /* need to finish raw, first */ finish_process(); wait_process(1); - /* XXX should check sync file to see if really done? */ + if (!syncf_done(sfile)) { + fprintf(stderr, + "%s: %s did not complete rendering of view %s\n", + progname, c_rpiece, vs); + quit(1); + } } if (!vdef(RAWFILE) || strcmp(vval(RAWFILE),vval(PICTURE))) { /* build pfilt command */