--- ray/src/common/bsdf.h 2012/09/02 15:33:15 2.19 +++ ray/src/common/bsdf.h 2013/04/21 21:36:23 2.22 @@ -1,4 +1,4 @@ -/* RCSid $Id: bsdf.h,v 2.19 2012/09/02 15:33:15 greg Exp $ */ +/* RCSid $Id: bsdf.h,v 2.22 2013/04/21 21:36:23 greg Exp $ */ /* * bsdf.h * @@ -58,10 +58,13 @@ extern "C" { typedef enum {SDEnone=0, SDEmemory, SDEfile, SDEformat, SDEargument, SDEdata, SDEsupport, SDEinternal, SDEunknown} SDError; -/* English ASCII strings corresponding to ennumerated errors */ +/* English strings corresponding to ennumerated errors */ extern const char *SDerrorEnglish[]; -/* Additional information on last error (ASCII English) */ +/* Pointer to error list in preferred language */ +extern const char **SDerrorList; + +/* Additional information on last error (generally in English) */ extern char SDerrorDetail[]; /* Holder for BSDF value and spectral color */ @@ -152,8 +155,8 @@ extern int SDretainSet; /* =SDretainNone by default * #define SDisLoaded(sd) ((sd)->rLambFront.spec.flags != 0) -/* Report an error to the indicated stream (in English) */ -extern SDError SDreportEnglish(SDError ec, FILE *fp); +/* Report an error to the indicated stream */ +extern SDError SDreportError(SDError ec, FILE *fp); /* Shorten file path to useable BSDF name, removing suffix */ extern void SDclipName(char res[SDnameLn], const char *fname); @@ -190,10 +193,10 @@ extern SDError SDsampComponent(SDValue *sv, FVECT ioV extern void SDmultiSamp(double t[], int n, double randX); /* Map a [0,1]^2 square to a unit radius disk */ -void SDsquare2disk(double ds[2], double seedx, double seedy); +extern void SDsquare2disk(double ds[2], double seedx, double seedy); /* Map point on unit disk to a unit square in [0,1]^2 range */ -void SDdisk2square(double sq[2], double diskx, double disky); +extern void SDdisk2square(double sq[2], double diskx, double disky); /***************************************************************** * The calls below are the ones most applications require. @@ -201,7 +204,7 @@ void SDdisk2square(double sq[2], double diskx, doubl */ /* Get BSDF from cache (or load and cache it on first call) */ -/* Report any problems to stderr (in English), return NULL on failure */ +/* Report any problems to stderr, return NULL on failure */ extern const SDData *SDcacheFile(const char *fname); /* Free a BSDF from our cache (clear all if sd==NULL) */ @@ -245,66 +248,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 }