244 |
|
} |
245 |
|
|
246 |
|
|
247 |
+ |
/* Evaluate irradiance contributions */ |
248 |
|
static void |
249 |
< |
rayirrad( /* compute irradiance rather than radiance */ |
249 |
< |
RAY *r |
250 |
< |
) |
249 |
> |
eval_irrad(FVECT org, FVECT dir) |
250 |
|
{ |
251 |
< |
r->rot = 1e-5; /* pretend we hit surface */ |
252 |
< |
VSUM(r->rop, r->rorg, r->rdir, r->rot); |
253 |
< |
r->ron[0] = -r->rdir[0]; |
254 |
< |
r->ron[1] = -r->rdir[1]; |
255 |
< |
r->ron[2] = -r->rdir[2]; |
256 |
< |
r->rod = 1.0; |
257 |
< |
/* compute result */ |
258 |
< |
r->revf = raytrace; |
259 |
< |
(*ofun[Lamb.otype].funp)(&Lamb, r); |
260 |
< |
r->revf = rayirrad; |
251 |
> |
RAY thisray; |
252 |
> |
|
253 |
> |
VSUM(thisray.rorg, org, dir, 1.1e-4); |
254 |
> |
thisray.rdir[0] = -dir[0]; |
255 |
> |
thisray.rdir[1] = -dir[1]; |
256 |
> |
thisray.rdir[2] = -dir[2]; |
257 |
> |
thisray.rmax = 0.0; |
258 |
> |
rayorigin(&thisray, PRIMARY, NULL, NULL); |
259 |
> |
thisray.rot = 1e-5; /* pretend we hit surface */ |
260 |
> |
thisray.rod = 1.0; |
261 |
> |
VSUM(thisray.rop, org, dir, 1e-4); |
262 |
> |
samplendx++; /* compute result */ |
263 |
> |
(*ofun[Lamb.otype].funp)(&Lamb, &thisray); |
264 |
|
} |
265 |
|
|
266 |
|
|
267 |
< |
/* Evaluate ray contributions */ |
267 |
> |
/* Evaluate radiance contributions */ |
268 |
|
static void |
269 |
< |
eval_ray(FVECT org, FVECT dir, double dmax) |
269 |
> |
eval_rad(FVECT org, FVECT dir, double dmax) |
270 |
|
{ |
271 |
|
RAY thisray; |
272 |
|
/* set up ray */ |
273 |
+ |
VCOPY(thisray.rorg, org); |
274 |
+ |
VCOPY(thisray.rdir, dir); |
275 |
+ |
thisray.rmax = dmax; |
276 |
|
rayorigin(&thisray, PRIMARY, NULL, NULL); |
272 |
– |
if (imm_irrad) { |
273 |
– |
VSUM(thisray.rorg, org, dir, 1.1e-4); |
274 |
– |
thisray.rdir[0] = -dir[0]; |
275 |
– |
thisray.rdir[1] = -dir[1]; |
276 |
– |
thisray.rdir[2] = -dir[2]; |
277 |
– |
thisray.rmax = 0.0; |
278 |
– |
thisray.revf = rayirrad; |
279 |
– |
} else { |
280 |
– |
VCOPY(thisray.rorg, org); |
281 |
– |
VCOPY(thisray.rdir, dir); |
282 |
– |
thisray.rmax = dmax; |
283 |
– |
} |
277 |
|
samplendx++; /* call ray evaluation */ |
278 |
|
rayvalue(&thisray); |
279 |
|
} |
328 |
|
if ((yres <= 0) | (xres <= 0)) |
329 |
|
waitflush = 1; /* flush right after */ |
330 |
|
account = 1; |
331 |
< |
} else { /* else compute */ |
332 |
< |
eval_ray(orig, direc, lim_dist ? d : 0.0); |
331 |
> |
} else if (imm_irrad) { /* else compute */ |
332 |
> |
eval_irrad(orig, direc); |
333 |
> |
} else { |
334 |
> |
eval_rad(orig, direc, lim_dist ? d : 0.0); |
335 |
|
} |
336 |
|
done_contrib(); /* accumulate/output */ |
337 |
|
++lastdone; |