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.52 by greg, Sun Aug 23 00:56:00 2015 UTC vs.
Revision 2.58 by greg, Thu May 14 19:20:13 2020 UTC

# Line 47 | Line 47 | const SDCDst           SDemptyCD;
47   /* Cache of loaded BSDFs */
48   struct SDCache_s        *SDcacheList = NULL;
49  
50 < /* Retain BSDFs in cache list */
50 > /* Retain BSDFs in cache list? */
51   int                     SDretainSet = SDretainNone;
52  
53 + /* Maximum cache size for any given BSDF? */
54 + unsigned long           SDmaxCache = 0;         /* 0 == unlimited */
55 +
56   /* Report any error to the indicated stream */
57   SDError
58   SDreportError(SDError ec, FILE *fp)
# Line 496 | Line 499 | SDsampComponent(SDValue *sv, FVECT ioVec, double randX
499                  sv->cieY = cd->cTotal;
500          if (sv->cieY <= 1e-6) {         /* nothing to sample? */
501                  sv->spec = c_dfcolor;
502 <                memset(ioVec, 0, 3*sizeof(double));
502 >                memset(ioVec, 0, sizeof(FVECT));
503                  return SDEnone;
504          }
505                                          /* compute sample direction */
# Line 515 | Line 518 | SDsampComponent(SDValue *sv, FVECT ioVec, double randX
518                  c_cmix(&sv->spec, d, &sv->spec, coef[n], &sdc->cspec[n]);
519                  d += coef[n];
520          }
521 <                                        /* make sure everything is set */
519 <        c_ccvt(&sv->spec, C_CSXY+C_CSSPEC);
521 >        c_ccvt(&sv->spec, C_CSXY);      /* make sure (x,y) is set */
522          return SDEnone;
523   }
524  
# Line 649 | Line 651 | SDevalBSDF(SDValue *sv, const FVECT outVec, const FVEC
651          } else if (inFront) {
652                  *sv = sd->tLamb;
653                  sdf = (sd->tf != NULL) ? sd->tf : sd->tb;
654 <        } else /* inBack */ {
654 >        } else /* outFront & !inFront */ {
655                  *sv = sd->tLamb;
656                  sdf = (sd->tb != NULL) ? sd->tb : sd->tf;
657          }
# Line 665 | Line 667 | SDevalBSDF(SDValue *sv, const FVECT outVec, const FVEC
667                          sv->cieY += coef[nch];
668                  }
669          }
670 <                                        /* make sure everything is set */
669 <        c_ccvt(&sv->spec, C_CSXY+C_CSSPEC);
670 >        c_ccvt(&sv->spec, C_CSXY);      /* make sure (x,y) is set */
671          return SDEnone;
672   }
673  
# Line 770 | Line 771 | SDsampBSDF(SDValue *sv, FVECT ioVec, double randX, int
771          }
772          if (sv->cieY <= 1e-6) {         /* anything to sample? */
773                  sv->cieY = .0;
774 <                memset(ioVec, 0, 3*sizeof(double));
774 >                memset(ioVec, 0, sizeof(FVECT));
775                  return SDEnone;
776          }
777                                          /* scale random variable */
# Line 791 | Line 792 | SDsampBSDF(SDValue *sv, FVECT ioVec, double randX, int
792                  randX -= sd->tLamb.cieY;
793          }
794                                          /* else one of cumulative dist. */
795 <        for (i = 0; i < n && randX > cdarr[i]->cTotal; i++)
795 >        for (i = 0; i < n && randX >= cdarr[i]->cTotal; i++)
796                  randX -= cdarr[i]->cTotal;
797          if (i >= n)
798                  return SDEinternal;
# Line 816 | Line 817 | SDsampBSDF(SDValue *sv, FVECT ioVec, double randX, int
817   done:
818          if (cdarr != NULL)
819                  free(cdarr);
820 <                                        /* make sure everything is set */
820 <        c_ccvt(&sv->spec, C_CSXY+C_CSSPEC);
820 >        c_ccvt(&sv->spec, C_CSXY);      /* make sure (x,y) is set */
821          return SDEnone;
822   }
823  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines