376 |
|
) |
377 |
|
{ |
378 |
|
double *omega_iarr, *omega_oarr; |
379 |
< |
double dom, contrib, hemi_total; |
379 |
> |
double dom, contrib, hemi_total, full_total; |
380 |
|
int nneg; |
381 |
|
FVECT v; |
382 |
|
int i, o; |
456 |
|
sprintf(errmsg, "%d negative BSDF values (ignored)", nneg); |
457 |
|
error(WARNING, errmsg); |
458 |
|
} |
459 |
< |
/* reverse roles and check again */ |
459 |
> |
full_total = .0; /* reverse roles and check again */ |
460 |
|
for (o = 0; o < dp->nout; o++) { |
461 |
|
hemi_total = .0; |
462 |
|
for (i = dp->ninc; i--; ) |
468 |
|
o, 100.*hemi_total); |
469 |
|
error(WARNING, errmsg); |
470 |
|
} |
471 |
+ |
full_total += hemi_total*omega_oarr[o]; |
472 |
+ |
} |
473 |
+ |
full_total /= PI; |
474 |
+ |
if (full_total > 1.02) { |
475 |
+ |
sprintf(errmsg, "BSDF transfers %.1f%% of light", |
476 |
+ |
100.*full_total); |
477 |
+ |
error(WARNING, errmsg); |
478 |
|
} |
479 |
|
free(omega_iarr); free(omega_oarr); |
480 |
|
return(1); |