8 |
|
|
9 |
|
#include "rcontrib.h" |
10 |
|
#include "otypes.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; |
216 |
|
trace_contrib(RAY *r) |
217 |
|
{ |
218 |
|
MODCONT *mp; |
219 |
+ |
double bval; |
220 |
|
int bn; |
221 |
|
RREAL contr[3]; |
222 |
|
|
227 |
|
|
228 |
|
if (mp == NULL) /* not in our list? */ |
229 |
|
return; |
230 |
+ |
/* shadow ray not on source? */ |
231 |
+ |
if (r->rsrc >= 0 && source[r->rsrc].so != r->ro) |
232 |
+ |
return; |
233 |
|
|
234 |
< |
worldfunc(RCCONTEXT, r); /* get bin number */ |
235 |
< |
bn = (int)(evalue(mp->binv) + .5); |
236 |
< |
if ((bn < 0) | (bn >= mp->nbins)) { |
234 |
> |
worldfunc(RCCONTEXT, r); /* else get bin number */ |
235 |
> |
if ((bval = evalue(mp->binv)) <= -.5) |
236 |
> |
return; /* silently ignore */ |
237 |
> |
if ((bn = (int)(bval + .5)) >= mp->nbins) { |
238 |
|
error(WARNING, "bad bin number (ignored)"); |
239 |
|
return; |
240 |
|
} |
241 |
< |
raycontrib(contr, r, PRIMARY); |
241 |
> |
raycontrib(contr, r, PRIMARY); /* compute coefficient */ |
242 |
|
if (contrib) |
243 |
< |
multcolor(contr, r->rcol); |
243 |
> |
multcolor(contr, r->rcol); /* -> contribution */ |
244 |
|
addcolor(mp->cbin[bn], contr); |
245 |
|
} |
246 |
|
|
257 |
|
thisray.rdir[2] = -dir[2]; |
258 |
|
thisray.rmax = 0.0; |
259 |
|
rayorigin(&thisray, PRIMARY, NULL, NULL); |
260 |
< |
thisray.rot = 1e-5; /* pretend we hit surface */ |
260 |
> |
/* pretend we hit surface */ |
261 |
> |
thisray.rt = thisray.rot = 1e-5; |
262 |
|
thisray.rod = 1.0; |
263 |
+ |
VCOPY(thisray.ron, dir); |
264 |
|
VSUM(thisray.rop, org, dir, 1e-4); |
265 |
|
samplendx++; /* compute result */ |
266 |
|
(*ofun[Lamb.otype].funp)(&Lamb, &thisray); |
318 |
|
#endif |
319 |
|
while (getvec(orig) == 0 && getvec(direc) == 0) { |
320 |
|
d = normalize(direc); |
321 |
< |
if (nchild != -1 && (d == 0.0) & (accumulate != 1)) { |
321 |
> |
if (nchild != -1 && (d == 0.0) & (accumulate == 0)) { |
322 |
|
if (!ignore_warning_given++) |
323 |
|
error(WARNING, |
324 |
|
"dummy ray(s) ignored during accumulation\n"); |
328 |
|
lastray = lastdone = 0; |
329 |
|
++lastray; |
330 |
|
if (d == 0.0) { /* zero ==> flush */ |
331 |
< |
if ((yres <= 0) | (xres <= 0)) |
332 |
< |
waitflush = 1; /* flush right after */ |
333 |
< |
account = 1; |
331 |
> |
if ((yres <= 0) | (xres <= 1)) |
332 |
> |
waitflush = 1; /* flush after */ |
333 |
> |
if (nchild == -1) |
334 |
> |
account = 1; |
335 |
|
} else if (imm_irrad) { /* else compute */ |
336 |
|
eval_irrad(orig, direc); |
337 |
|
} else { |