--- ray/src/common/bsdf.h 2012/03/04 20:11:10 2.17 +++ ray/src/common/bsdf.h 2012/10/13 20:15:43 2.20 @@ -1,4 +1,4 @@ -/* RCSid $Id: bsdf.h,v 2.17 2012/03/04 20:11:10 greg Exp $ */ +/* RCSid $Id: bsdf.h,v 2.20 2012/10/13 20:15:43 greg Exp $ */ /* * bsdf.h * @@ -78,6 +78,8 @@ typedef struct SDCDst_s { /* ...encoded distribution extends struct */ } SDCDst; +extern const SDCDst SDemptyCD; /* empty distribution */ + /* Forward declaration of BSDF component */ typedef struct SDComp_s SDComponent; @@ -118,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 */ @@ -240,66 +245,6 @@ extern SDData *loadBSDF(char *name); /* Application-specific BSDF error translator (not part of our library) */ extern char *transSDError(SDError ec); - -/*################################################################*/ -/*######### DEPRECATED DEFINITIONS AWAITING PERMANENT REMOVAL #######*/ -/* - * Header for BSDF i/o and access routines - */ - -#include "mat4.h" - /* up directions */ -typedef enum { - UDzneg=-3, - UDyneg=-2, - UDxneg=-1, - UDunknown=0, - UDxpos=1, - UDypos=2, - UDzpos=3 -} UpDir; - /* BSDF coordinate calculation routines */ - /* vectors always point away from surface */ - -typedef int b_vecf2(FVECT v, int n, void *cd); -typedef int b_ndxf2(FVECT v, void *cd); -typedef double b_radf2(int n, void *cd); - -/* Bidirectional Scattering Distribution Function */ -struct BSDF_data { - int ninc; /* number of incoming directions */ - int nout; /* number of outgoing directions */ - float dim[3]; /* width, height, thickness (meters) */ - char *mgf; /* geometric description (if any) */ - void *ib_priv; /* input basis private data */ - b_vecf2 *ib_vec; /* get input vector from index */ - b_ndxf2 *ib_ndx; /* get input index from vector */ - b_radf2 *ib_ohm; /* get input radius for index */ - void *ob_priv; /* output basis private data */ - b_vecf2 *ob_vec; /* get output vector from index */ - b_ndxf2 *ob_ndx; /* get output index from vector */ - b_radf2 *ob_ohm; /* get output radius for index */ - float *bsdf; /* scattering distribution data */ -}; /* bidirectional scattering distrib. func. */ - -#define getBSDF_incvec(v,b,i) (*(b)->ib_vec)(v,i,(b)->ib_priv) -#define getBSDF_incndx(b,v) (*(b)->ib_ndx)(v,(b)->ib_priv) -#define getBSDF_incohm(b,i) (*(b)->ib_ohm)(i,(b)->ib_priv) -#define getBSDF_outvec(v,b,o) (*(b)->ob_vec)(v,o,(b)->ob_priv) -#define getBSDF_outndx(b,v) (*(b)->ob_ndx)(v,(b)->ob_priv) -#define getBSDF_outohm(b,o) (*(b)->ob_ohm)(o,(b)->ob_priv) -#define BSDF_value(b,i,o) (b)->bsdf[(o)*(b)->ninc + (i)] - -extern struct BSDF_data *load_BSDF(char *fname); -extern void free_BSDF(struct BSDF_data *b); -extern int r_BSDF_incvec(FVECT v, struct BSDF_data *b, int i, - double rv, MAT4 xm); -extern int r_BSDF_outvec(FVECT v, struct BSDF_data *b, int o, - double rv, MAT4 xm); -extern int getBSDF_xfm(MAT4 xm, FVECT nrm, UpDir ud, char *xfbuf); - -/*######### END DEPRECATED DEFINITIONS #######*/ -/*################################################################*/ #ifdef __cplusplus }