Back to index

radiance  4R0+20100331
bsdf.h
Go to the documentation of this file.
00001 /* RCSid $Id: bsdf.h,v 2.1 2009/06/17 20:41:47 greg Exp $ */
00002 /*
00003  * Header for BSDF i/o and access routines
00004  */
00005                             /* up directions */
00006 typedef enum {
00007        UDzneg=-3,
00008        UDyneg=-2,
00009        UDxneg=-1,
00010        UDunknown=0,
00011        UDxpos=1,
00012        UDypos=2,
00013        UDzpos=3
00014 } UpDir;
00015                             /* BSDF coordinate calculation routines */
00016                             /* vectors always point away from surface */
00017 typedef int   b_vecf(FVECT, int, void *);
00018 typedef int   b_ndxf(FVECT, void *);
00019 typedef double       b_radf(int, void *);
00020 
00021 /* Bidirectional Scattering Distribution Function */
00022 struct BSDF_data {
00023        int    ninc;                /* number of incoming directions */
00024        int    nout;                /* number of outgoing directions */
00025        void   *ib_priv;            /* input basis private data */
00026        b_vecf *ib_vec;             /* get input vector from index */
00027        b_ndxf *ib_ndx;             /* get input index from vector */
00028        b_radf *ib_ohm;             /* get input radius for index */
00029        void   *ob_priv;            /* output basis private data */
00030        b_vecf *ob_vec;             /* get output vector from index */
00031        b_ndxf *ob_ndx;             /* get output index from vector */
00032        b_radf *ob_ohm;             /* get output radius for index */
00033        float  *bsdf;               /* scattering distribution data */
00034 };                          /* bidirectional scattering distrib. func. */
00035 
00036 #define getBSDF_incvec(v,b,i)      (*(b)->ib_vec)(v,i,(b)->ib_priv)
00037 #define getBSDF_incndx(b,v) (*(b)->ib_ndx)(v,(b)->ib_priv)
00038 #define getBSDF_incohm(b,i) (*(b)->ib_ohm)(i,(b)->ib_priv)
00039 #define getBSDF_outvec(v,b,o)      (*(b)->ob_vec)(v,o,(b)->ob_priv)
00040 #define getBSDF_outndx(b,v) (*(b)->ob_ndx)(v,(b)->ob_priv)
00041 #define getBSDF_outohm(b,o) (*(b)->ob_ohm)(o,(b)->ob_priv)
00042 #define BSDF_value(b,i,o)   (b)->bsdf[(o)*(b)->ninc + (i)]
00043 
00044 extern struct BSDF_data *load_BSDF(char *fname);
00045 extern void free_BSDF(struct BSDF_data *b);
00046 extern int r_BSDF_incvec(FVECT v, struct BSDF_data *b, int i,
00047                             double rv, MAT4 xm);
00048 extern int r_BSDF_outvec(FVECT v, struct BSDF_data *b, int o,
00049                             double rv, MAT4 xm);
00050 extern int getBSDF_xfm(MAT4 xm, FVECT nrm, UpDir ud);