--- ray/src/util/rad.c 2011/02/25 06:51:51 2.105 +++ 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.105 2011/02/25 06:51:51 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, @@ -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 */