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

Comparing ray/src/cv/bsdfrep.h (file contents):
Revision 2.16 by greg, Wed Mar 12 21:15:31 2014 UTC vs.
Revision 2.24 by greg, Sat Jan 30 01:31:57 2016 UTC

# Line 5 | Line 5
5   *      G. Ward
6   */
7  
8 + #ifndef _BSDFREP_H_
9 + #define _BSDFREP_H_
10 +
11   #include "bsdf.h"
12  
13 + #ifdef __cplusplus
14 + extern "C" {
15 + #endif
16 +
17   #ifndef GRIDRES
18   #define GRIDRES         (1<<8)          /* grid resolution per side */
19   #endif
# Line 14 | Line 21
21   #define ANG2R(r)        (int)((r)*((1<<16)/M_PI))
22   #define R2ANG(c)        (((c)+.5)*(M_PI/(1<<16)))
23  
24 +                                        /* moderated cosine factor */
25 + #define COSF(z)         (fabs(z)*0.98 + 0.02)
26 +
27   typedef union {
28          struct {
29                  float           v;              /* DSF sum */
# Line 24 | Line 34 | typedef union {
34  
35   typedef struct {
36          float           peak;           /* lobe value at peak */
37 +        C_CHROMA        chroma;         /* encoded chromaticity */
38          unsigned short  crad;           /* radius (coded angle) */
39 <        unsigned char   gx, gy;         /* grid position */
39 >        unsigned short  gx, gy;         /* grid position */
40   } RBFVAL;                       /* radial basis function value */
41  
42   struct s_rbfnode;               /* forward declaration of RBF struct */
# Line 72 | Line 83 | extern int             single_plane_incident;
83   extern int              input_orient;
84   extern int              output_orient;
85  
86 +                                /* represented colorimetry */
87 + typedef enum {RBCphotopic, RBCtristimulus, RBCspectral, RBCunknown} RBColor;
88 +
89 + extern RBColor          rbf_colorimetry;
90 +
91 + extern const char       *RBCident[];
92 +
93                                  /* log BSDF histogram */
94   #define HISTLEN         256
95   #define BSDF2BIG        (1./M_PI)
# Line 83 | Line 101 | extern unsigned long   bsdf_hist[HISTLEN];
101  
102                                  /* BSDF value for boundary regions */
103   extern double           bsdf_min;
104 + extern double           bsdf_spec_val;
105 + extern double           bsdf_spec_rad;
106  
107                                  /* processed incident DSF measurements */
108   extern RBFNODE          *dsf_list;
# Line 102 | Line 122 | extern MIGRATION       *mig_list;
122  
123   #define BSDFREP_FMT     "BSDF_RBFmesh"
124  
125 + #define BSDFREP_MAGIC   0x5a3c
126 +
127                                  /* global argv[0] */
128   extern char             *progname;
129  
# Line 113 | Line 135 | extern char            *progname;
135                                  /* our loaded grid for this incident angle */
136   extern double           theta_in_deg, phi_in_deg;
137   extern GRIDVAL          dsf_grid[GRIDRES][GRIDRES];
138 + extern float            (*spec_grid)[GRIDRES][GRIDRES];
139 + extern int              nspec_grid;
140  
141   /* Register new input direction */
142   extern int              new_input_direction(double new_theta, double new_phi);
# Line 141 | Line 165 | extern void            ovec_from_pos(FVECT vec, int xpos, int yp
165   /* Compute grid position from normalized input/output vector */
166   extern void             pos_from_vec(int pos[2], const FVECT vec);
167  
168 < /* Evaluate RBF for DSF at the given normalized outgoing direction */
168 > /* Evaluate BSDF at the given normalized outgoing direction */
169   extern double           eval_rbfrep(const RBFNODE *rp, const FVECT outvec);
170  
171 + extern SDError          eval_rbfcol(SDValue *sv,
172 +                                        const RBFNODE *rp, const FVECT outvec);
173 +
174   /* Insert a new directional scattering function in our global list */
175   extern int              insert_dsf(RBFNODE *newrbf);
176  
# Line 170 | Line 197 | extern void            save_bsdf_rep(FILE *ofp);
197   /* Read a BSDF mesh interpolant from the given binary stream */
198   extern int              load_bsdf_rep(FILE *ifp);
199  
200 + /* Set up visible spectrum sampling */
201 + extern void             set_spectral_samples(int nspec);
202 +
203   /* Start new DSF input grid */
204   extern void             new_bsdf_data(double new_theta, double new_phi);
205  
206   /* Add BSDF data point */
207   extern void             add_bsdf_data(double theta_out, double phi_out,
208 <                                        double val, int isDSF);
208 >                                        const double val[], int isDSF);
209  
210   /* Count up filled nodes and build RBF representation from current grid */
211   extern RBFNODE *        make_rbfrep(void);
# Line 186 | Line 216 | extern void            build_mesh(void);
216   /* Find edge(s) for interpolating the given vector, applying symmetry */
217   extern int              get_interp(MIGRATION *miga[3], FVECT invec);
218  
219 + /* Return single-lobe specular RBF for the given incident direction */
220 + extern RBFNODE *        def_rbf_spec(const FVECT invec);
221 +
222   /* Advect and allocate new RBF along edge (internal call) */
223   extern RBFNODE *        e_advect_rbf(const MIGRATION *mig,
224                                          const FVECT invec, int lobe_lim);
225  
226 + /* Compute distance between two RBF lobes (internal call) */
227 + extern double           lobe_distance(RBFVAL *rbf1, RBFVAL *rbf2);
228 +
229 + /* Compute mass transport plan (internal call) */
230 + extern void             plan_transport(MIGRATION *mig);
231 +
232   /* Partially advect between recorded incident angles and allocate new RBF */
233   extern RBFNODE *        advect_rbf(const FVECT invec, int lobe_lim);
234 +
235 + #ifdef __cplusplus
236 + }
237 + #endif
238 + #endif  /* _BSDFREP_H_ */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines