--- ray/src/common/bsdf.h 2011/06/05 20:27:14 2.13 +++ ray/src/common/bsdf.h 2012/09/02 15:33:15 2.19 @@ -1,4 +1,4 @@ -/* RCSid $Id: bsdf.h,v 2.13 2011/06/05 20:27:14 greg Exp $ */ +/* RCSid $Id: bsdf.h,v 2.19 2012/09/02 15:33:15 greg Exp $ */ /* * bsdf.h * @@ -30,6 +30,10 @@ extern "C" { #endif +#ifdef _WIN32 +#define strcasecmp stricmp +#endif + #define SDnameLn 128 /* maximum BSDF name length */ #define SDmaxCh 3 /* maximum # spectral channels */ @@ -67,13 +71,15 @@ typedef struct { } SDValue; /* Cached, encoded, cumulative distribution for one incident (solid) angle */ -#define SD_CDIST_BASE double cTotal; \ - struct SDCDst_s *next +#define SD_CDIST_BASE(styp) double cTotal; \ + struct styp *next typedef struct SDCDst_s { - SD_CDIST_BASE; /* base fields first */ + SD_CDIST_BASE(SDCDst_s); /* base fields first */ /* ...encoded distribution extends struct */ } SDCDst; +extern const SDCDst SDemptyCD; /* empty distribution */ + /* Forward declaration of BSDF component */ typedef struct SDComp_s SDComponent; @@ -114,12 +120,15 @@ typedef struct { /* Loaded BSDF data */ typedef struct { char name[SDnameLn]; /* BSDF name (usu. derived from file) */ + char matn[SDnameLn]; /* material name */ + char makr[SDnameLn]; /* manufacturer */ char *mgf; /* geometric description (if any) */ float dim[3]; /* width, height, thickness (meters) */ SDValue rLambFront; /* diffuse front reflectance */ SDValue rLambBack; /* diffuse rear reflectance */ SDValue tLamb; /* diffuse transmission */ - SDSpectralDF *rf, *rb, *tf; /* non-diffuse BSDF components */ + SDSpectralDF *rf, *rb; /* non-diffuse BRDF components */ + SDSpectralDF *tf, *tb; /* non-diffuse BTDF components */ } SDData; /* List of loaded BSDFs */ @@ -130,9 +139,9 @@ extern struct SDCache_s { *next; } *SDcacheList; /* Global BSDF cache */ -/* BSDF cache retention preference */ -#define SDretainNone 0 /* free unreferenced data*/ -#define SDretainBSDFs 1 /* keep loaded BSDFs in cache */ +/* BSDF cache retention policies */ +#define SDretainNone 0 /* free unreferenced BSDF data */ +#define SDretainBSDFs 1 /* keep loaded BSDFs in memory */ #define SDretainAll 2 /* also keep cumulative cache data */ extern int SDretainSet; /* =SDretainNone by default */ @@ -151,6 +160,9 @@ extern void SDclipName(char res[SDnameLn], const char /* Allocate new spectral distribution function */ extern SDSpectralDF *SDnewSpectralDF(int nc); + +/* Add component(s) to spectral distribution function */ +extern SDSpectralDF *SDaddComponent(SDSpectralDF *odf, int nadd); /* Free a spectral distribution function */ extern void SDfreeSpectralDF(SDSpectralDF *df);