115 |
|
{ |
116 |
|
unsigned long vcount = (hresolu > 1) ? (unsigned long)hresolu*vresolu |
117 |
|
: vresolu; |
118 |
< |
long nextflush = hresolu; |
118 |
> |
long nextflush = (vresolu > 0) & (hresolu > 1) ? 0 : hresolu; |
119 |
|
FILE *fp; |
120 |
|
double d; |
121 |
|
FVECT orig, direc; |
160 |
|
|
161 |
|
d = normalize(direc); |
162 |
|
if (d == 0.0) { /* zero ==> flush */ |
163 |
– |
if (nproc > 1 && ray_fifo_flush() < 0) |
164 |
– |
error(USER, "lost children"); |
165 |
– |
bogusray(); |
163 |
|
if (--nextflush <= 0 || !vcount) { |
164 |
+ |
if (nproc > 1 && ray_fifo_flush() < 0) |
165 |
+ |
error(USER, "lost children"); |
166 |
+ |
bogusray(); |
167 |
|
fflush(stdout); |
168 |
< |
nextflush = hresolu; |
169 |
< |
} |
168 |
> |
nextflush = (vresolu > 0) & (hresolu > 1) ? 0 : |
169 |
> |
hresolu; |
170 |
> |
} else |
171 |
> |
bogusray(); |
172 |
|
} else { /* compute and print */ |
173 |
|
rtcompute(orig, direc, lim_dist ? d : 0.0); |
174 |
|
/* flush if time */ |
322 |
|
RAY *r |
323 |
|
) |
324 |
|
{ |
325 |
+ |
void (*old_revf)(RAY *) = r->revf; |
326 |
+ |
|
327 |
|
r->rot = 1e-5; /* pretend we hit surface */ |
328 |
|
VSUM(r->rop, r->rorg, r->rdir, r->rot); |
329 |
|
r->ron[0] = -r->rdir[0]; |
331 |
|
r->ron[2] = -r->rdir[2]; |
332 |
|
r->rod = 1.0; |
333 |
|
/* compute result */ |
334 |
+ |
r->revf = raytrace; |
335 |
|
(*ofun[Lamb.otype].funp)(&Lamb, r); |
336 |
+ |
r->revf = old_revf; |
337 |
|
} |
338 |
|
|
339 |
|
|
344 |
|
double dmax |
345 |
|
) |
346 |
|
{ |
347 |
< |
if (imm_irrad) { /* set up ray */ |
347 |
> |
/* set up ray */ |
348 |
> |
rayorigin(&thisray, PRIMARY, NULL, NULL); |
349 |
> |
if (imm_irrad) { |
350 |
|
VSUM(thisray.rorg, org, dir, 1.1e-4); |
351 |
|
thisray.rdir[0] = -dir[0]; |
352 |
|
thisray.rdir[1] = -dir[1]; |
353 |
|
thisray.rdir[2] = -dir[2]; |
354 |
|
thisray.rmax = 0.0; |
355 |
+ |
thisray.revf = rayirrad; |
356 |
|
} else { |
357 |
|
VCOPY(thisray.rorg, org); |
358 |
|
VCOPY(thisray.rdir, dir); |
359 |
|
thisray.rmax = dmax; |
360 |
+ |
if (castonly) |
361 |
+ |
thisray.revf = raycast; |
362 |
|
} |
352 |
– |
rayorigin(&thisray, PRIMARY, NULL, NULL); |
353 |
– |
/* special case evaluators */ |
354 |
– |
if (castonly) |
355 |
– |
thisray.revf = raycast; |
356 |
– |
else if (imm_irrad) |
357 |
– |
thisray.revf = rayirrad; |
358 |
– |
|
363 |
|
if (ray_pnprocs > 1) { /* multiprocessing FIFO? */ |
364 |
|
if (ray_fifo_in(&thisray) < 0) |
365 |
|
error(USER, "lost children"); |