| 97 |
|
r->rweight *= exp(-re); |
| 98 |
|
} |
| 99 |
|
rayclear(r); |
| 100 |
+ |
if (r->crtype & SHADOW) /* shadow commitment */ |
| 101 |
+ |
return(0); |
| 102 |
|
if (maxdepth <= 0 && rc != NULL) { /* Russian roulette */ |
| 103 |
|
if (minweight <= 0.0) |
| 104 |
|
error(USER, "zero ray weight in Russian roulette"); |
| 348 |
|
|
| 349 |
|
extern void |
| 350 |
|
raycontrib( /* compute (cumulative) ray contribution */ |
| 351 |
< |
COLOR rc, |
| 351 |
> |
double rc[3], |
| 352 |
|
const RAY *r, |
| 353 |
|
int flags |
| 354 |
|
) |
| 355 |
|
{ |
| 356 |
< |
COLOR eext, ext1; |
| 357 |
< |
|
| 356 |
< |
setcolor(eext, 0., 0., 0.); |
| 357 |
< |
setcolor(rc, 1., 1., 1.); |
| 356 |
> |
double eext[3]; |
| 357 |
> |
int i; |
| 358 |
|
|
| 359 |
+ |
eext[0] = eext[1] = eext[2] = 0.; |
| 360 |
+ |
rc[0] = rc[1] = rc[2] = 1.; |
| 361 |
+ |
|
| 362 |
|
while (r != NULL && r->crtype&flags) { |
| 363 |
< |
multcolor(rc, r->rcoef); |
| 364 |
< |
copycolor(ext1, r->cext); |
| 365 |
< |
scalecolor(ext1, r->rot); |
| 366 |
< |
addcolor(eext, ext1); |
| 363 |
> |
for (i = 3; i--; ) { |
| 364 |
> |
rc[i] *= colval(r->rcoef,i); |
| 365 |
> |
eext[i] += r->rot * colval(r->cext,i); |
| 366 |
> |
} |
| 367 |
|
r = r->parent; |
| 368 |
|
} |
| 369 |
< |
if (intens(eext) > FTINY) { |
| 370 |
< |
setcolor(ext1, exp(-colval(eext,RED)), |
| 371 |
< |
exp(-colval(eext,GRN)), |
| 369 |
< |
exp(-colval(eext,BLU))); |
| 370 |
< |
multcolor(rc, ext1); |
| 371 |
< |
} |
| 369 |
> |
for (i = 3; i--; ) |
| 370 |
> |
rc[i] *= (eext[i] <= FTINY) ? 1. : |
| 371 |
> |
(eext[i] > 300.) ? 0. : exp(-eext[i]); |
| 372 |
|
} |
| 373 |
|
|
| 374 |
|
|