9 |
|
* in the surface plane pointed to the right as seen from the front. |
10 |
|
* This means the Y-axis is "up" and the Z-axis is the surface normal. |
11 |
|
* |
12 |
+ |
* Note that we reverse the identification of "front" and "back" from |
13 |
+ |
* the conventions used in WINDOW 6. "Front" in our library points |
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." |
18 |
|
* |
19 |
|
* Created by Greg Ward on 1/10/11. |
33 |
|
#define SDnameLn 128 /* maximum BSDF name length */ |
34 |
|
#define SDmaxCh 3 /* maximum # spectral channels */ |
35 |
|
|
36 |
< |
/* Component flags for SDsampBSDF() and SDhemiScatter() */ |
36 |
> |
/* Component flags for SDsampBSDF() and SDdirectHemi() */ |
37 |
|
#define SDsampR 0x1 /* include reflection */ |
38 |
|
#define SDsampT 0x2 /* include transmission */ |
39 |
|
#define SDsampS 0x3 /* include scattering (R+T) */ |
44 |
|
#define SDsampSpS 0x7 /* include non-diffuse scattering */ |
45 |
|
#define SDsampAll 0xF /* include everything */ |
46 |
|
|
47 |
< |
/* Projected solid angle query flags fos SDsizeBSDF() */ |
48 |
< |
#define SDqueryInc 0x1 /* query incoming vector */ |
49 |
< |
#define SDqueryOut 0x2 /* query outgoing vector */ |
50 |
< |
#define SDqueryMin 0x4 /* query minimum proj. solid angle */ |
46 |
< |
#define SDqueryMax 0x8 /* query maximum proj. solid angle */ |
47 |
> |
/* Projected solid angle query flags for SDsizeBSDF() */ |
48 |
> |
#define SDqueryVal 0x0 /* query single value */ |
49 |
> |
#define SDqueryMin 0x1 /* query minimum proj. solid angle */ |
50 |
> |
#define SDqueryMax 0x2 /* query maximum proj. solid angle */ |
51 |
|
|
52 |
|
/* Error codes: normal return, out of memory, file i/o, file format, bad argument, |
53 |
|
bad data, unsupported feature, internal error, unknown error */ |
83 |
|
int (*getBSDFs)(float coef[SDmaxCh], const FVECT outVec, |
84 |
|
const FVECT inVec, const void *dist); |
85 |
|
/* query non-diffuse PSA for vector */ |
86 |
< |
SDError (*queryProjSA)(double *psa, const FVECT vec, |
87 |
< |
int qflags, const void *dist); |
86 |
> |
SDError (*queryProjSA)(double *psa, const FVECT v1, |
87 |
> |
const RREAL *v2, int qflags, |
88 |
> |
const void *dist); |
89 |
|
/* get cumulative distribution */ |
90 |
|
const SDCDst *(*getCDist)(const FVECT inVec, SDComponent *sdc); |
91 |
|
/* sample cumulative distribution */ |
141 |
|
* The following routines are less commonly used by applications. |
142 |
|
*/ |
143 |
|
|
144 |
< |
#define SDisLoaded(sd) ((sd)->rLambFront.spec.clock != 0) |
144 |
> |
#define SDisLoaded(sd) ((sd)->rLambFront.spec.flags != 0) |
145 |
|
|
146 |
|
/* Report an error to the indicated stream (in English) */ |
147 |
|
extern SDError SDreportEnglish(SDError ec, FILE *fp); |
155 |
|
/* Free a spectral distribution function */ |
156 |
|
extern void SDfreeSpectralDF(SDSpectralDF *df); |
157 |
|
|
158 |
< |
/* Initialize an unused BSDF struct (clears to zeroes) */ |
159 |
< |
extern void SDclearBSDF(SDData *sd); |
158 |
> |
/* Initialize an unused BSDF struct and assign name (calls SDclipName) */ |
159 |
> |
extern void SDclearBSDF(SDData *sd, const char *fname); |
160 |
|
|
161 |
|
/* Load a BSDF struct from the given file (keeps name unchanged) */ |
162 |
|
extern SDError SDloadFile(SDData *sd, const char *fname); |
196 |
|
/* Free a BSDF from our cache (clear all if NULL) */ |
197 |
|
extern void SDfreeCache(const SDData *sd); |
198 |
|
|
199 |
< |
/* Query projected solid angle resolution for non-diffuse BSDF direction */ |
200 |
< |
extern SDError SDsizeBSDF(double *projSA, const FVECT vec, |
201 |
< |
int qflags, const SDData *sd); |
199 |
> |
/* Query projected solid angle resolution for non-diffuse BSDF direction(s) */ |
200 |
> |
extern SDError SDsizeBSDF(double *projSA, const FVECT v1, |
201 |
> |
const RREAL *v2, int qflags, |
202 |
> |
const SDData *sd); |
203 |
|
|
204 |
|
/* Return BSDF for the given incident and scattered ray vectors */ |
205 |
|
extern SDError SDevalBSDF(SDValue *sv, const FVECT outVec, |
229 |
|
/* Transform and normalize direction (column) vector */ |
230 |
|
extern SDError SDmapDir(FVECT resVec, RREAL vMtx[3][3], |
231 |
|
const FVECT inpVec); |
232 |
+ |
|
233 |
+ |
/* System-specific BSDF loading routine (not part of our library) */ |
234 |
+ |
extern SDData *loadBSDF(char *name); |
235 |
+ |
|
236 |
+ |
/* System-specific BSDF error translator (not part of our library) */ |
237 |
+ |
extern char *transSDError(SDError ec); |
238 |
|
|
239 |
|
/*################################################################*/ |
240 |
|
/*######### DEPRECATED DEFINITIONS AWAITING PERMANENT REMOVAL #######*/ |