ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/bsdf.c
(Generate patch)

Comparing ray/src/common/bsdf.c (file contents):
Revision 2.6 by greg, Fri Sep 3 23:53:50 2010 UTC vs.
Revision 2.7 by greg, Tue Sep 7 23:10:50 2010 UTC

# Line 376 | Line 376 | check_bsdf_data(       /* check that BSDF data is sane */
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;
# Line 456 | Line 456 | check_bsdf_data(       /* check that BSDF data is sane */
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--; )
# Line 468 | Line 468 | check_bsdf_data(       /* check that BSDF data is sane */
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);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines