7 |
|
*/ |
8 |
|
|
9 |
|
#include "rcontrib.h" |
10 |
– |
#include "source.h" |
10 |
|
#include "otypes.h" |
11 |
< |
#include "platform.h" |
11 |
> |
#include "source.h" |
12 |
|
|
13 |
|
char *shm_boundary = NULL; /* boundary of shared memory */ |
14 |
|
|
177 |
|
/* set shared memory boundary */ |
178 |
|
shm_boundary = strcpy((char *)malloc(16), "SHM_BOUNDARY"); |
179 |
|
} |
180 |
+ |
for (i = 0; i < nsources; i++) /* tracing to sources as well */ |
181 |
+ |
source[i].sflags |= SFOLLOW; |
182 |
|
if (yres > 0) { /* set up flushing & ray counts */ |
183 |
|
if (xres > 0) |
184 |
|
raysleft = (RNUMBER)xres*yres; |
189 |
|
if ((account = accumulate) > 1) |
190 |
|
raysleft *= accumulate; |
191 |
|
waitflush = (yres > 0) & (xres > 1) ? 0 : xres; |
191 |
– |
/* tracing to sources as well */ |
192 |
– |
for (i = 0; i < nsources; i++) |
193 |
– |
source[i].sflags |= SFOLLOW; |
192 |
|
|
193 |
|
if (nproc > 1 && in_rchild()) /* forked child? */ |
194 |
|
return; /* return to main processing loop */ |
226 |
|
|
227 |
|
if (mp == NULL) /* not in our list? */ |
228 |
|
return; |
229 |
+ |
/* shadow ray not on source? */ |
230 |
+ |
if (r->rsrc >= 0 && source[r->rsrc].so != r->ro) |
231 |
+ |
return; |
232 |
|
|
233 |
< |
worldfunc(RCCONTEXT, r); /* get bin number */ |
233 |
> |
worldfunc(RCCONTEXT, r); /* else get bin number */ |
234 |
|
bn = (int)(evalue(mp->binv) + .5); |
235 |
|
if ((bn < 0) | (bn >= mp->nbins)) { |
236 |
|
error(WARNING, "bad bin number (ignored)"); |
237 |
|
return; |
238 |
|
} |
239 |
< |
raycontrib(contr, r, PRIMARY); |
239 |
> |
raycontrib(contr, r, PRIMARY); /* compute coefficient */ |
240 |
|
if (contrib) |
241 |
< |
multcolor(contr, r->rcol); |
241 |
> |
multcolor(contr, r->rcol); /* -> contribution */ |
242 |
|
addcolor(mp->cbin[bn], contr); |
243 |
|
} |
244 |
|
|
255 |
|
thisray.rdir[2] = -dir[2]; |
256 |
|
thisray.rmax = 0.0; |
257 |
|
rayorigin(&thisray, PRIMARY, NULL, NULL); |
258 |
< |
thisray.rot = 1e-5; /* pretend we hit surface */ |
258 |
> |
/* pretend we hit surface */ |
259 |
> |
thisray.rt = thisray.rot = 1e-5; |
260 |
|
thisray.rod = 1.0; |
261 |
+ |
VCOPY(thisray.ron, dir); |
262 |
|
VSUM(thisray.rop, org, dir, 1e-4); |
263 |
|
samplendx++; /* compute result */ |
264 |
|
(*ofun[Lamb.otype].funp)(&Lamb, &thisray); |
316 |
|
#endif |
317 |
|
while (getvec(orig) == 0 && getvec(direc) == 0) { |
318 |
|
d = normalize(direc); |
319 |
< |
if (nchild != -1 && (d == 0.0) & (accumulate != 1)) { |
319 |
> |
if (nchild != -1 && (d == 0.0) & (accumulate == 0)) { |
320 |
|
if (!ignore_warning_given++) |
321 |
|
error(WARNING, |
322 |
|
"dummy ray(s) ignored during accumulation\n"); |
326 |
|
lastray = lastdone = 0; |
327 |
|
++lastray; |
328 |
|
if (d == 0.0) { /* zero ==> flush */ |
329 |
< |
if ((yres <= 0) | (xres <= 0)) |
330 |
< |
waitflush = 1; /* flush right after */ |
331 |
< |
account = 1; |
329 |
> |
if ((yres <= 0) | (xres <= 1)) |
330 |
> |
waitflush = 1; /* flush after */ |
331 |
> |
if (nchild == -1) |
332 |
> |
account = 1; |
333 |
|
} else if (imm_irrad) { /* else compute */ |
334 |
|
eval_irrad(orig, direc); |
335 |
|
} else { |
340 |
|
if (raysleft && !--raysleft) |
341 |
|
break; /* preemptive EOI */ |
342 |
|
} |
343 |
< |
if ((accumulate <= 0) | (account < accumulate)) { |
343 |
> |
if (nchild != -1 && (accumulate <= 0) | (account < accumulate)) { |
344 |
|
if (account < accumulate) { |
345 |
|
error(WARNING, "partial accumulation in final record"); |
346 |
|
accumulate -= account; |