278 |
|
/* compute foreground and background */ |
279 |
|
foremat = backmat = 0; |
280 |
|
/* foreground */ |
281 |
< |
copystruct(&fr, r); |
281 |
> |
fr = *r; |
282 |
|
if (coef > FTINY) |
283 |
|
foremat = rayshade(&fr, fore); |
284 |
|
/* background */ |
285 |
< |
copystruct(&br, r); |
285 |
> |
br = *r; |
286 |
|
if (coef < 1.0-FTINY) |
287 |
|
backmat = rayshade(&br, back); |
288 |
|
/* check for transparency */ |
289 |
< |
if (backmat ^ foremat) |
289 |
> |
if (backmat ^ foremat) { |
290 |
|
if (backmat && coef > FTINY) |
291 |
|
raytrans(&fr); |
292 |
|
else if (foremat && coef < 1.0-FTINY) |
293 |
|
raytrans(&br); |
294 |
+ |
} |
295 |
|
/* mix perturbations */ |
296 |
|
for (i = 0; i < 3; i++) |
297 |
|
r->pert[i] = coef*fr.pert[i] + (1.0-coef)*br.pert[i]; |