--- ray/src/common/bsdf.h 2018/01/05 20:15:50 2.25 +++ ray/src/common/bsdf.h 2021/12/07 23:49:50 2.29 @@ -1,4 +1,4 @@ -/* RCSid $Id: bsdf.h,v 2.25 2018/01/05 20:15:50 schorsch Exp $ */ +/* RCSid $Id: bsdf.h,v 2.29 2021/12/07 23:49:50 greg Exp $ */ /* * bsdf.h * @@ -84,17 +84,10 @@ extern const SDCDst SDemptyCD; /* empty distribution * typedef struct SDComp_s SDComponent; /* Methods needed to handle BSDF components (nothing is optional) */ -#ifdef __cplusplus -/* in C++, the const puts the type into the local anonymous namespace, - making it a private (and different) type for each file using this header. -*/ typedef struct { -#else -typedef const struct { -#endif /* return non-diffuse BSDF */ - int (*getBSDFs)(float coef[SDmaxCh], const FVECT outVec, - const FVECT inVec, SDComponent *sdc); + int (*getBSDFs)(float coef[SDmaxCh], const FVECT inVec, + const FVECT outVec, SDComponent *sdc); /* query non-diffuse PSA for vector */ SDError (*queryProjSA)(double *psa, const FVECT v1, const RREAL *v2, int qflags, @@ -111,7 +104,7 @@ typedef const struct { /* Structure to hold a spectral BSDF component (typedef SDComponent above) */ struct SDComp_s { C_COLOR cspec[SDmaxCh]; /* component spectral bases */ - SDFunc *func; /* methods for this component */ + const SDFunc *func; /* methods for this component */ void *dist; /* loaded distribution data */ SDCDst *cdList; /* cumulative distribution cache */ }; @@ -133,7 +126,8 @@ typedef struct { double dim[3]; /* width, height, thickness (meters) */ SDValue rLambFront; /* diffuse front reflectance */ SDValue rLambBack; /* diffuse rear reflectance */ - SDValue tLamb; /* diffuse transmission */ + SDValue tLambFront; /* diffuse front transmittance */ + SDValue tLambBack; /* diffuse back transmittance */ SDSpectralDF *rf, *rb; /* non-diffuse BRDF components */ SDSpectralDF *tf, *tb; /* non-diffuse BTDF components */ } SDData; @@ -152,6 +146,7 @@ extern struct SDCache_s { #define SDretainAll 2 /* also keep cumulative cache data */ extern int SDretainSet; /* =SDretainNone by default */ +extern unsigned long SDmaxCache; /* =0 (unlimited) by default */ /***************************************************************** * The following routines are less commonly used by applications. @@ -220,8 +215,8 @@ extern SDError SDsizeBSDF(double *projSA, const FVECT const SDData *sd); /* Return BSDF for the given incident and scattered ray vectors */ -extern SDError SDevalBSDF(SDValue *sv, const FVECT outVec, - const FVECT inVec, const SDData *sd); +extern SDError SDevalBSDF(SDValue *sv, const FVECT inVec, + const FVECT outVec, const SDData *sd); /* Compute directional hemispherical scattering at given incident angle */ extern double SDdirectHemi(const FVECT inVec,