ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/bsdf.h
Revision: 2.3
Committed: Fri Sep 3 23:53:50 2010 UTC (13 years, 8 months ago) by greg
Content type: text/plain
Branch: MAIN
Changes since 2.2: +4 -2 lines
Log Message:
Working version of genBSDF with detail geometry support in mkillum

File Contents

# User Rev Content
1 greg 2.3 /* RCSid $Id: bsdf.h,v 2.2 2010/06/14 22:02:22 greg Exp $ */
2 greg 2.1 /*
3     * Header for BSDF i/o and access routines
4     */
5 greg 2.2
6     #ifndef _RAD_BSDF_H_
7     #define _RAD_BSDF_H_
8 greg 2.1 /* up directions */
9     typedef enum {
10     UDzneg=-3,
11     UDyneg=-2,
12     UDxneg=-1,
13     UDunknown=0,
14     UDxpos=1,
15     UDypos=2,
16     UDzpos=3
17     } UpDir;
18     /* BSDF coordinate calculation routines */
19     /* vectors always point away from surface */
20     typedef int b_vecf(FVECT, int, void *);
21     typedef int b_ndxf(FVECT, void *);
22     typedef double b_radf(int, void *);
23    
24     /* Bidirectional Scattering Distribution Function */
25     struct BSDF_data {
26     int ninc; /* number of incoming directions */
27     int nout; /* number of outgoing directions */
28 greg 2.3 float dim[3]; /* width, height, thickness (meters) */
29     char *mgf; /* geometric description (if any) */
30 greg 2.1 void *ib_priv; /* input basis private data */
31     b_vecf *ib_vec; /* get input vector from index */
32     b_ndxf *ib_ndx; /* get input index from vector */
33     b_radf *ib_ohm; /* get input radius for index */
34     void *ob_priv; /* output basis private data */
35     b_vecf *ob_vec; /* get output vector from index */
36     b_ndxf *ob_ndx; /* get output index from vector */
37     b_radf *ob_ohm; /* get output radius for index */
38     float *bsdf; /* scattering distribution data */
39     }; /* bidirectional scattering distrib. func. */
40    
41     #define getBSDF_incvec(v,b,i) (*(b)->ib_vec)(v,i,(b)->ib_priv)
42     #define getBSDF_incndx(b,v) (*(b)->ib_ndx)(v,(b)->ib_priv)
43     #define getBSDF_incohm(b,i) (*(b)->ib_ohm)(i,(b)->ib_priv)
44     #define getBSDF_outvec(v,b,o) (*(b)->ob_vec)(v,o,(b)->ob_priv)
45     #define getBSDF_outndx(b,v) (*(b)->ob_ndx)(v,(b)->ob_priv)
46     #define getBSDF_outohm(b,o) (*(b)->ob_ohm)(o,(b)->ob_priv)
47     #define BSDF_value(b,i,o) (b)->bsdf[(o)*(b)->ninc + (i)]
48    
49     extern struct BSDF_data *load_BSDF(char *fname);
50     extern void free_BSDF(struct BSDF_data *b);
51     extern int r_BSDF_incvec(FVECT v, struct BSDF_data *b, int i,
52     double rv, MAT4 xm);
53     extern int r_BSDF_outvec(FVECT v, struct BSDF_data *b, int o,
54     double rv, MAT4 xm);
55 greg 2.3 extern int getBSDF_xfm(MAT4 xm, FVECT nrm, UpDir ud, char *xfbuf);
56 greg 2.2
57     #endif /* ! _RAD_BSDF_H_ */