34 |
|
p->ra[i].r[1][0] = sl[2] * 256.; |
35 |
|
p->ra[i].r[1][1] = sl[3] * 256.; |
36 |
|
d = hdray(ro, rd, hdlist[p->hd], gc, p->ra[i].r); |
37 |
+ |
if (!vdef(OBSTRUCTIONS)) |
38 |
+ |
d *= frandom(); /* random offset */ |
39 |
|
if (p->offset != NULL) { |
40 |
< |
VSUM(ro, ro, rd, d); /* exterior only */ |
40 |
> |
VSUM(ro, ro, rd, d); /* advance ray */ |
41 |
|
p->offset[i] = d; |
42 |
|
} |
43 |
|
VCOPY(rod, ro); |
74 |
|
/* already closed? */ |
75 |
|
if (!nprocs) |
76 |
|
return; |
75 |
– |
/* report activity */ |
77 |
|
wputs("closing rtrace process...\n"); |
78 |
|
/* flush beam queue */ |
79 |
|
done_packets(flush_queue()); |
80 |
+ |
/* sync holodeck */ |
81 |
+ |
hdsync(NULL, 1); |
82 |
|
/* close rtrace */ |
83 |
|
if ((status = end_rtrace())) |
84 |
|
error(WARNING, "bad exit status from rtrace"); |
95 |
|
if (nprocs > 0) /* already running? */ |
96 |
|
return; |
97 |
|
wputs("restarting rtrace process...\n"); |
98 |
+ |
starttime = time(NULL); /* reset start time and counts */ |
99 |
+ |
npacksdone = nraysdone = 0L; |
100 |
+ |
if (vdef(TIME)) /* reset end time */ |
101 |
+ |
endtime = starttime + vflt(TIME)*3600. + .5; |
102 |
|
if (vdef(RIF)) { /* rerun rad to update octree */ |
103 |
|
sprintf(combuf, "rad -v 0 -s -w %s", vval(RIF)); |
104 |
|
if (system(combuf)) |
156 |
|
} |
157 |
|
rtargc += wordfile(rtargv+rtargc, tf1); /* get rtrace options */ |
158 |
|
unlink(tf1); /* clean up */ |
159 |
+ |
} |
160 |
+ |
|
161 |
+ |
|
162 |
+ |
report(t) /* report progress so far */ |
163 |
+ |
time_t t; |
164 |
+ |
{ |
165 |
+ |
static time_t seconds2go = 1000000; |
166 |
+ |
|
167 |
+ |
if (t == 0L) |
168 |
+ |
t = time(NULL); |
169 |
+ |
sprintf(errmsg, "%ld packets (%ld rays) done after %.2f hours\n", |
170 |
+ |
npacksdone, nraysdone, (t-starttime)/3600.); |
171 |
+ |
eputs(errmsg); |
172 |
+ |
if (seconds2go == 1000000) |
173 |
+ |
seconds2go = vdef(REPORT) ? (long)(vflt(REPORT)*60. + .5) : 0L; |
174 |
+ |
if (seconds2go) |
175 |
+ |
reporttime = t + seconds2go; |
176 |
|
} |