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.58 by greg, Thu May 14 19:20:13 2020 UTC vs.
Revision 2.59 by greg, Sat Mar 27 17:50:18 2021 UTC

# Line 381 | Line 381 | SDfreeBSDF(SDData *sd)
381          sd->rLambFront.spec.flags = 0;
382          sd->rLambBack.cieY = .0;
383          sd->rLambBack.spec.flags = 0;
384 <        sd->tLamb.cieY = .0;
385 <        sd->tLamb.spec.flags = 0;
384 >        sd->tLambFront.cieY = .0;
385 >        sd->tLambFront.spec.flags = 0;
386 >        sd->tLambBack.cieY = .0;
387 >        sd->tLambBack.spec.flags = 0;
388   }
389  
390   /* Find writeable BSDF by name, or allocate new cache entry if absent */
# Line 649 | Line 651 | SDevalBSDF(SDValue *sv, const FVECT outVec, const FVEC
651                  *sv = sd->rLambBack;
652                  sdf = sd->rb;
653          } else if (inFront) {
654 <                *sv = sd->tLamb;
654 >                *sv = sd->tLambFront;
655                  sdf = (sd->tf != NULL) ? sd->tf : sd->tb;
656          } else /* outFront & !inFront */ {
657 <                *sv = sd->tLamb;
657 >                *sv = sd->tLambBack;
658                  sdf = (sd->tb != NULL) ? sd->tb : sd->tf;
659          }
660          sv->cieY *= 1./M_PI;
# Line 695 | Line 697 | SDdirectHemi(const FVECT inVec, int sflags, const SDDa
697          if ((sflags & SDsampDf+SDsampR) != SDsampDf+SDsampR)
698                  hsum = .0;
699          if ((sflags & SDsampDf+SDsampT) == SDsampDf+SDsampT)
700 <                hsum += sd->tLamb.cieY;
700 >                hsum += (inVec[2] > 0) ?
701 >                                sd->tLambFront.cieY : sd->tLambBack.cieY;
702                                          /* gather non-diffuse components */
703          i = (((sflags & SDsampSp+SDsampR) == SDsampSp+SDsampR) &
704                          (rdf != NULL)) ? rdf->ncomp : 0;
# Line 748 | Line 751 | SDsampBSDF(SDValue *sv, FVECT ioVec, double randX, int
751                  sv->cieY = .0;
752          rdiff = sv->cieY;
753          if ((sflags & SDsampDf+SDsampT) == SDsampDf+SDsampT)
754 <                sv->cieY += sd->tLamb.cieY;
754 >                sv->cieY += inFront ? sd->tLambFront.cieY : sd->tLambBack.cieY;
755                                          /* gather non-diffuse components */
756          i = nr = (((sflags & SDsampSp+SDsampR) == SDsampSp+SDsampR) &
757                          (rdf != NULL)) ? rdf->ncomp : 0;
# Line 784 | Line 787 | SDsampBSDF(SDValue *sv, FVECT ioVec, double randX, int
787          randX -= rdiff;
788                                          /* diffuse transmission? */
789          if ((sflags & SDsampDf+SDsampT) == SDsampDf+SDsampT) {
790 <                if (randX < sd->tLamb.cieY) {
791 <                        sv->spec = sd->tLamb.spec;
792 <                        SDdiffuseSamp(ioVec, !inFront, randX/sd->tLamb.cieY);
790 >                const SDValue   *sdt = inFront ? &sd->tLambFront : &sd->tLambBack;
791 >                if (randX < sdt->cieY) {
792 >                        sv->spec = sdt->spec;
793 >                        SDdiffuseSamp(ioVec, !inFront, randX/sdt->cieY);
794                          goto done;
795                  }
796 <                randX -= sd->tLamb.cieY;
796 >                randX -= sdt->cieY;
797          }
798                                          /* else one of cumulative dist. */
799          for (i = 0; i < n && randX >= cdarr[i]->cTotal; i++)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines