--- ray/src/hd/rholo2.c 1997/12/12 18:33:50 3.6 +++ ray/src/hd/rholo2.c 1998/07/06 18:17:20 3.13 @@ -1,4 +1,4 @@ -/* Copyright (c) 1997 Silicon Graphics, Inc. */ +/* Copyright (c) 1998 Silicon Graphics, Inc. */ #ifndef lint static char SCCSid[] = "$SunId$ SGI"; @@ -34,8 +34,10 @@ register PACKET *p; p->ra[i].r[1][0] = sl[2] * 256.; p->ra[i].r[1][1] = sl[3] * 256.; d = hdray(ro, rd, hdlist[p->hd], gc, p->ra[i].r); + if (!vdef(OBSTRUCTIONS)) + d *= frandom(); /* random offset */ if (p->offset != NULL) { - VSUM(ro, ro, rd, d); /* exterior only */ + VSUM(ro, ro, rd, d); /* advance ray */ p->offset[i] = d; } VCOPY(rod, ro); @@ -72,14 +74,17 @@ done_rtrace() /* clean up and close rtrace calculati /* already closed? */ if (!nprocs) return; - wputs("closing rtrace process...\n"); /* flush beam queue */ done_packets(flush_queue()); + /* sync holodeck */ + hdsync(NULL, 1); /* close rtrace */ if ((status = end_rtrace())) error(WARNING, "bad exit status from rtrace"); - if (vdef(REPORT)) /* report time */ + if (vdef(REPORT)) { /* report time */ + eputs("rtrace process closed\n"); report(0); + } return(status); /* return status */ } @@ -90,7 +95,6 @@ new_rtrace() /* restart rtrace calculation */ if (nprocs > 0) /* already running? */ return; - wputs("restarting rtrace process...\n"); starttime = time(NULL); /* reset start time and counts */ npacksdone = nraysdone = 0L; if (vdef(TIME)) /* reset end time */ @@ -102,14 +106,16 @@ new_rtrace() /* restart rtrace calculation */ } if (start_rtrace() < 1) /* start rtrace */ error(WARNING, "cannot restart rtrace"); - else if (vdef(REPORT)) + else if (vdef(REPORT)) { + eputs("rtrace process restarted\n"); report(0); + } } getradfile() /* run rad and get needed variables */ { - static short mvar[] = {OCTREE,-1}; + static short mvar[] = {OCTREE,EYESEP,-1}; static char tf1[] = TEMPLATE; char tf2[64]; char combuf[256]; @@ -118,7 +124,7 @@ getradfile() /* run rad and get needed variables */ register char *cp; /* check if rad file specified */ if (!vdef(RIF)) - return; + return(0); /* create rad command */ mktemp(tf1); sprintf(tf2, "%s.rif", tf1); @@ -141,17 +147,17 @@ getradfile() /* run rad and get needed variables */ strcpy(pippt, "> /dev/null"); /* nothing to match */ else sprintf(cp, ")[ \t]*=' > %s", tf2); - if (system(combuf)) { - unlink(tf2); /* clean up */ - unlink(tf1); - error(SYSTEM, "cannot execute rad command"); - } +#ifdef DEBUG + wputs(combuf); wputs("\n"); +#endif + system(combuf); /* ignore exit code */ if (pippt == NULL) { loadvars(tf2); /* load variables */ unlink(tf2); } rtargc += wordfile(rtargv+rtargc, tf1); /* get rtrace options */ unlink(tf1); /* clean up */ + return(1); }