| 14 |
|
* in the +Z direction, towards the interior of the space rather |
| 15 |
|
* than the exterior. |
| 16 |
|
* |
| 17 |
< |
* BSDF vectors always oriented away from surface, even when "incident." |
| 17 |
> |
* BSDF incident & exiting vectors are always oriented away from surface. |
| 18 |
|
* |
| 19 |
|
* Created by Greg Ward on 1/10/11. |
| 20 |
|
* |
| 30 |
|
extern "C" { |
| 31 |
|
#endif |
| 32 |
|
|
| 33 |
+ |
#ifdef _WIN32 |
| 34 |
+ |
#define strcasecmp stricmp |
| 35 |
+ |
#endif |
| 36 |
+ |
|
| 37 |
|
#define SDnameLn 128 /* maximum BSDF name length */ |
| 38 |
|
#define SDmaxCh 3 /* maximum # spectral channels */ |
| 39 |
|
|
| 71 |
|
} SDValue; |
| 72 |
|
|
| 73 |
|
/* Cached, encoded, cumulative distribution for one incident (solid) angle */ |
| 74 |
< |
#define SD_CDIST_BASE double cTotal; \ |
| 75 |
< |
struct SDCDst_s *next |
| 74 |
> |
#define SD_CDIST_BASE(styp) double cTotal; \ |
| 75 |
> |
struct styp *next |
| 76 |
|
typedef struct SDCDst_s { |
| 77 |
< |
SD_CDIST_BASE; /* base fields first */ |
| 77 |
> |
SD_CDIST_BASE(SDCDst_s); /* base fields first */ |
| 78 |
|
/* ...encoded distribution extends struct */ |
| 79 |
|
} SDCDst; |
| 80 |
|
|
| 117 |
|
|
| 118 |
|
/* Loaded BSDF data */ |
| 119 |
|
typedef struct { |
| 120 |
< |
char name[SDnameLn]; /* BSDF name (derived from file) */ |
| 120 |
> |
char name[SDnameLn]; /* BSDF name (usu. derived from file) */ |
| 121 |
|
char *mgf; /* geometric description (if any) */ |
| 122 |
|
float dim[3]; /* width, height, thickness (meters) */ |
| 123 |
|
SDValue rLambFront; /* diffuse front reflectance */ |
| 134 |
|
*next; |
| 135 |
|
} *SDcacheList; /* Global BSDF cache */ |
| 136 |
|
|
| 137 |
< |
/* BSDF cache retention preference */ |
| 138 |
< |
#define SDretainNone 0 /* free unreferenced data (default) */ |
| 139 |
< |
#define SDretainBSDFs 1 /* keep loaded BSDFs in cache */ |
| 137 |
> |
/* BSDF cache retention policies */ |
| 138 |
> |
#define SDretainNone 0 /* free unreferenced BSDF data */ |
| 139 |
> |
#define SDretainBSDFs 1 /* keep loaded BSDFs in memory */ |
| 140 |
|
#define SDretainAll 2 /* also keep cumulative cache data */ |
| 141 |
|
|
| 142 |
< |
extern int SDretainSet; /* set to SDretainNone by default */ |
| 142 |
> |
extern int SDretainSet; /* =SDretainNone by default */ |
| 143 |
|
|
| 144 |
|
/***************************************************************** |
| 145 |
|
* The following routines are less commonly used by applications. |
| 193 |
|
*/ |
| 194 |
|
|
| 195 |
|
/* Get BSDF from cache (or load and cache it on first call) */ |
| 196 |
< |
/* Report any problems to stderr and return NULL on failure */ |
| 196 |
> |
/* Report any problems to stderr (in English), return NULL on failure */ |
| 197 |
|
extern const SDData *SDcacheFile(const char *fname); |
| 198 |
|
|
| 199 |
< |
/* Free a BSDF from our cache (clear all if NULL) */ |
| 199 |
> |
/* Free a BSDF from our cache (clear all if sd==NULL) */ |
| 200 |
|
extern void SDfreeCache(const SDData *sd); |
| 201 |
|
|
| 202 |
|
/* Query projected solid angle resolution for non-diffuse BSDF direction(s) */ |
| 221 |
|
* Directions may be passed unnormalized to these routines. |
| 222 |
|
*/ |
| 223 |
|
|
| 224 |
< |
/* Compute World->BSDF transform from surface normal and up (Y) vector */ |
| 224 |
> |
/* Compute World->BSDF transform from surface normal and BSDF up vector */ |
| 225 |
|
extern SDError SDcompXform(RREAL vMtx[3][3], const FVECT sNrm, |
| 226 |
|
const FVECT uVec); |
| 227 |
|
|
| 232 |
|
extern SDError SDmapDir(FVECT resVec, RREAL vMtx[3][3], |
| 233 |
|
const FVECT inpVec); |
| 234 |
|
|
| 235 |
< |
/* System-specific BSDF loading routine (not part of our library) */ |
| 235 |
> |
/* Application-specific BSDF loading routine (not part of our library) */ |
| 236 |
|
extern SDData *loadBSDF(char *name); |
| 237 |
|
|
| 238 |
< |
/* System-specific BSDF error translator (not part of our library) */ |
| 238 |
> |
/* Application-specific BSDF error translator (not part of our library) */ |
| 239 |
|
extern char *transSDError(SDError ec); |
| 240 |
|
|
| 241 |
|
/*################################################################*/ |