| 1 |
greg |
3.6 |
/* RCSid $Id: bsdf_t.h,v 3.5 2011/04/19 21:31:22 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.6 |
/* Variable-resolution BSDF holder */
|
| 33 |
|
|
typedef struct {
|
| 34 |
|
|
int isxmit; /* transmitted component? */
|
| 35 |
|
|
SDNode *st; /* BSDF tree */
|
| 36 |
|
|
} SDTre;
|
| 37 |
|
|
|
| 38 |
|
|
/* Holder for cumulative distribution (sum of BSDF * projSA) */
|
| 39 |
|
|
typedef struct {
|
| 40 |
|
|
SD_CDIST_BASE; /* base fields; must come first */
|
| 41 |
|
|
double clim[2][2]; /* input coordinate limits */
|
| 42 |
|
|
double max_psa; /* maximum projected solid angle */
|
| 43 |
|
|
int isxmit; /* transmitted component? */
|
| 44 |
|
|
int calen; /* cumulative array length */
|
| 45 |
|
|
struct {
|
| 46 |
|
|
unsigned hndx; /* hilbert index */
|
| 47 |
|
|
unsigned cuml; /* cumulative value */
|
| 48 |
|
|
} carr[1]; /* cumulative array (extends struct) */
|
| 49 |
|
|
} SDTreCDst;
|
| 50 |
|
|
|
| 51 |
greg |
3.4 |
#ifdef _EZXML_H
|
| 52 |
greg |
3.1 |
/* Load a variable-resolution BSDF tree from an open XML file */
|
| 53 |
greg |
3.3 |
extern SDError SDloadTre(SDData *sd, ezxml_t wtl);
|
| 54 |
greg |
3.4 |
#endif
|
| 55 |
greg |
3.1 |
|
| 56 |
|
|
/* Our matrix handling routines */
|
| 57 |
greg |
3.5 |
extern SDFunc SDhandleTre;
|
| 58 |
greg |
3.1 |
|
| 59 |
|
|
#ifdef __cplusplus
|
| 60 |
|
|
}
|
| 61 |
|
|
#endif
|
| 62 |
|
|
#endif /* ! _BSDF_T_H_ */
|