| 411 |
|
) |
| 412 |
|
{ |
| 413 |
|
static int warnedPM = 0; |
| 414 |
+ |
double re, ge, be; |
| 415 |
+ |
SCOLOR ce; |
| 416 |
|
|
| 417 |
|
setscolor(rc, 1., 1., 1.); |
| 418 |
+ |
re = ge = be = 0.; |
| 419 |
|
|
| 420 |
|
while (r != NULL && r->crtype&flags) { |
| 421 |
+ |
/* include this ray coefficient */ |
| 422 |
|
smultscolor(rc, r->rcoef); |
| 423 |
< |
/* check for participating medium */ |
| 420 |
< |
if (bright(r->cext) > FTINY) { |
| 421 |
< |
double re = r->rot*colval(r->cext,RED), |
| 422 |
< |
ge = r->rot*colval(r->cext,GRN), |
| 423 |
< |
be = r->rot*colval(r->cext,BLU); |
| 424 |
< |
SCOLOR ce; |
| 425 |
< |
setscolor(ce, re<=FTINY ? 1. : re>92. ? 0. : exp(-re), |
| 426 |
< |
ge<=FTINY ? 1. : ge>92. ? 0. : exp(-ge), |
| 427 |
< |
be<=FTINY ? 1. : be>92. ? 0. : exp(-be)); |
| 428 |
< |
smultscolor(rc, ce); |
| 429 |
< |
} |
| 423 |
> |
/* check participating medium */ |
| 424 |
|
if (!warnedPM && bright(r->albedo) > FTINY) { |
| 425 |
|
error(WARNING, |
| 426 |
|
"ray contribution calculation does not support participating media"); |
| 427 |
|
warnedPM++; |
| 428 |
|
} |
| 429 |
+ |
/* sum PM extinction */ |
| 430 |
+ |
re += r->rot*colval(r->cext,RED); |
| 431 |
+ |
ge += r->rot*colval(r->cext,GRN); |
| 432 |
+ |
be += r->rot*colval(r->cext,BLU); |
| 433 |
+ |
/* descend the tree */ |
| 434 |
|
r = r->parent; |
| 435 |
|
} |
| 436 |
+ |
/* cumulative extinction */ |
| 437 |
+ |
setscolor(ce, re<=FTINY ? 1. : re>92. ? 0. : exp(-re), |
| 438 |
+ |
ge<=FTINY ? 1. : ge>92. ? 0. : exp(-ge), |
| 439 |
+ |
be<=FTINY ? 1. : be>92. ? 0. : exp(-be)); |
| 440 |
+ |
smultscolor(rc, ce); |
| 441 |
|
} |
| 442 |
|
|
| 443 |
|
|