ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/bsdf_m.h
(Generate patch)

Comparing ray/src/common/bsdf_m.h (file contents):
Revision 3.1 by greg, Fri Feb 18 00:40:25 2011 UTC vs.
Revision 3.7 by greg, Thu Apr 2 16:40:32 2015 UTC

# Line 1 | Line 1
1 + /* RCSid $Id$ */
2   /*
3   *  bsdf_m.h
4   *  
5 < *  Support for BSDF matrices
5 > *  Support for BSDF matrices.
6 > *  Assumes "bsdf.h" already included.
7 > *  Include after "ezxml.h" for SDloadMtx() declaration.
8   *
9   *  Created by Greg Ward on 2/2/11.
10   *
# Line 14 | Line 17
17   extern "C" {
18   #endif
19                                  /* Fixed-position coordinate functions */
20 < typedef int     b_vecf(FVECT vec, int ndx, double randX, void *c_data);
20 > typedef int     b_vecf(FVECT vec, double ndxr, void *c_data);
21   typedef int     b_ndxf(const FVECT vec, void *c_data);
22   typedef double  b_ohmf(int ndx, void *c_data);
23  
# Line 30 | Line 33 | typedef struct {
33          b_vecf          *ob_vec;        /* get output vector from index */
34          b_ndxf          *ob_ndx;        /* get output index from vector */
35          b_ohmf          *ob_ohm;        /* get output proj. SA for index */
36 +        C_CHROMA        *chroma;        /* chromaticity data */
37          float           bsdf[1];        /* scattering data (extends struct) */
38   } SDMat;
39  
40   /* Matrix BSDF accessors */
41 < #define mBSDF_incvec(v,b,i)     (*(b)->ib_vec)(v,i,(b)->ib_priv)
41 > #define mBSDF_incvec(v,b,ix)    (*(b)->ib_vec)(v,ix,(b)->ib_priv)
42   #define mBSDF_incndx(b,v)       (*(b)->ib_ndx)(v,(b)->ib_priv)
43   #define mBSDF_incohm(b,i)       (*(b)->ib_ohm)(i,(b)->ib_priv)
44 < #define mBSDF_outvec(v,b,o)     (*(b)->ob_vec)(v,o,(b)->ob_priv)
44 > #define mBSDF_outvec(v,b,ox)    (*(b)->ob_vec)(v,ox,(b)->ob_priv)
45   #define mBSDF_outndx(b,v)       (*(b)->ob_ndx)(v,(b)->ob_priv)
46   #define mBSDF_outohm(b,o)       (*(b)->ob_ohm)(o,(b)->ob_priv)
47   #define mBSDF_value(b,i,o)      (b)->bsdf[(o)*(b)->ninc + (i)]
48  
49   /* Holder for cumulative distribution (sum of BSDF * projSA) */
50 < typedef struct {
51 <        SD_CDIST_BASE;                  /* base fields; must come first */
50 > typedef struct SDMatCDst_s {
51 >        SD_CDIST_BASE(SDMatCDst_s);     /* base fields; must come first */
52          int             indx;           /* incident angle index */
53          void            *ob_priv;       /* private data for generator */
54          b_vecf          *ob_vec;        /* outbound vector generator */
# Line 52 | Line 56 | typedef struct {
56          unsigned        carr[1];        /* cumulative array (extends struct) */
57   } SDMatCDst;    
58  
59 + #ifdef _EZXML_H
60   /* Load a set of BSDF matrices from an open XML file */
61 < extern SDError          SDloadMtx(SDData *sd, ezxml_t fl);
61 > extern SDError          SDloadMtx(SDData *sd, ezxml_t wtl);
62 > #endif
63  
64   /* Our matrix handling routines */
65   extern SDFunc           SDhandleMtx;
66 +
67 + /******** Klems basis declarations for more intimate access ********/
68 +
69 + #define MAXLATS         46              /* maximum number of latitudes */
70 +
71 + /* BSDF angle specification */
72 + typedef struct {
73 +        char    name[64];               /* basis name */
74 +        int     nangles;                /* total number of directions */
75 +        struct {
76 +                float   tmin;                   /* starting theta */
77 +                int     nphis;                  /* number of phis (0 term) */
78 +        } lat[MAXLATS+1];               /* latitudes */
79 + } ANGLE_BASIS;
80 +
81 + #define MAXABASES       7               /* limit on defined bases */
82 +
83 + extern ANGLE_BASIS      abase_list[MAXABASES];
84 +
85 + extern int              nabases;        /* current number of defined bases */
86 +
87 + extern C_COLOR  mtx_RGB_prim[3];        /* matrix RGB primaries  */
88 + extern float    mtx_RGB_coef[3];        /* corresponding Y coefficients */
89 +
90 + /* Get color or grayscale value for BSDF in the given directions */
91 + extern int              mBSDF_color(float coef[], const SDMat *b, int i, int o);
92 +
93 + /* Get vector for this angle basis index (front exiting) */
94 + extern b_vecf           fo_getvec;
95 +
96 + /* Get index corresponding to the given vector (front exiting) */
97 + extern b_ndxf           fo_getndx;
98 +
99 + /* Get projected solid angle for this angle basis index (universal) */
100 + extern b_ohmf           io_getohm;
101 +
102 + /* Get vector for this angle basis index (back incident) */
103 + extern b_vecf           bi_getvec;
104 +
105 + /* Get index corresponding to the vector (back incident) */
106 + extern b_ndxf           bi_getndx;
107 +
108 + /* Get vector for this angle basis index (back exiting) */
109 + extern b_vecf           bo_getvec;
110 +
111 + /* Get index corresponding to the vector (back exiting) */
112 + extern b_ndxf           bo_getndx;
113 +
114 + /* Get vector for this angle basis index (front incident) */
115 + extern b_vecf           fi_getvec;
116 +
117 + /* Get index corresponding to the vector (front incident) */
118 + extern b_ndxf           fi_getndx;
119  
120   #ifdef __cplusplus
121   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines