ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/bsdf_t.h
Revision: 3.9
Committed: Sun Aug 21 22:38:12 2011 UTC (12 years, 8 months ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: rad4R1
Changes since 3.8: +4 -3 lines
Log Message:
Minor improvements to direct specular sampling

File Contents

# User Rev Content
1 greg 3.9 /* RCSid $Id: bsdf_t.h,v 3.8 2011/06/03 18:12:58 greg Exp $ */
2 greg 3.1 /*
3     * bsdf_t.h
4     *
5 greg 3.4 * Support for variable-resolution BSDF trees.
6     * Assumes "bsdf.h" already included.
7     * Include after "ezxml.h" for SDloadTre() declaration.
8 greg 3.1 *
9     * Created by Greg Ward on 2/2/11.
10     *
11     */
12    
13     #ifndef _BSDF_T_H_
14     #define _BSDF_T_H_
15    
16     #ifdef __cplusplus
17     extern "C" {
18     #endif
19    
20     #define SD_MAXDIM 4 /* maximum expected # dimensions */
21    
22     /* Basic node structure for variable-resolution BSDF data */
23     typedef struct SDNode_s {
24     short ndim; /* number of dimensions */
25     short log2GR; /* log(2) of grid resolution (< 0 for tree) */
26     union {
27     struct SDNode_s *t[1]; /* subtree pointers */
28     float v[1]; /* scattering value(s) */
29     } u; /* subtrees or values (extends struct) */
30     } SDNode;
31    
32 greg 3.7 #define SD_UFRONT 0x1 /* flag for BSDF uses front side */
33     #define SD_UBACK 0x2 /* flag for BSDF uses back side */
34     #define SD_XMIT 0x3 /* combine the two for transmission */
35    
36 greg 3.6 /* Variable-resolution BSDF holder */
37     typedef struct {
38 greg 3.7 int sidef; /* transmitted component? */
39 greg 3.6 SDNode *st; /* BSDF tree */
40     } SDTre;
41    
42     /* Holder for cumulative distribution (sum of BSDF * projSA) */
43 greg 3.9 typedef struct SDTreCDst_s {
44     /* base fields; must come first */
45     SD_CDIST_BASE(SDTreCDst_s);
46 greg 3.6 double clim[2][2]; /* input coordinate limits */
47     double max_psa; /* maximum projected solid angle */
48 greg 3.8 short sidef; /* which side(s) to use */
49     short isodist; /* isotropic distribution? */
50 greg 3.6 int calen; /* cumulative array length */
51     struct {
52     unsigned hndx; /* hilbert index */
53     unsigned cuml; /* cumulative value */
54     } carr[1]; /* cumulative array (extends struct) */
55     } SDTreCDst;
56    
57 greg 3.4 #ifdef _EZXML_H
58 greg 3.1 /* Load a variable-resolution BSDF tree from an open XML file */
59 greg 3.3 extern SDError SDloadTre(SDData *sd, ezxml_t wtl);
60 greg 3.4 #endif
61 greg 3.1
62     /* Our matrix handling routines */
63 greg 3.5 extern SDFunc SDhandleTre;
64 greg 3.1
65     #ifdef __cplusplus
66     }
67     #endif
68     #endif /* ! _BSDF_T_H_ */