27 |
|
UDypos=2, |
28 |
|
UDzpos=3 |
29 |
|
} UpDir; |
30 |
+ |
/* BSDF coordinate calculation routines */ |
31 |
+ |
/* vectors always point away from surface */ |
32 |
+ |
typedef int b_vecf(FVECT, int, char *); |
33 |
+ |
typedef int b_ndxf(FVECT, char *); |
34 |
+ |
typedef double b_radf(int, char *); |
35 |
|
|
36 |
+ |
/* Bidirectional Scattering Distribution Function */ |
37 |
|
struct BSDF_data { |
32 |
– |
double om_scale; /* maximum solid angle (sr/256) */ |
38 |
|
int ninc; /* number of incoming directions */ |
34 |
– |
int32 *inc_dir; /* incoming direction codes */ |
35 |
– |
BYTE *inc_rad; /* incoming radians to neighbor */ |
39 |
|
int nout; /* number of outgoing directions */ |
40 |
< |
int32 *out_dir; /* outgoing direction codes */ |
41 |
< |
BYTE *out_rad; /* outgoing radians to neighbor */ |
40 |
> |
char ib_priv[32]; /* input basis private data */ |
41 |
> |
b_vecf *ib_vec; /* get input vector from index */ |
42 |
> |
b_ndxf *ib_ndx; /* get input index from vector */ |
43 |
> |
b_radf *ib_rad; /* get input radius for index */ |
44 |
> |
char ob_priv[32]; /* output basis private data */ |
45 |
> |
b_vecf *ob_vec; /* get output vector from index */ |
46 |
> |
b_ndxf *ob_ndx; /* get output index from vector */ |
47 |
> |
b_radf *ob_rad; /* get output radius for index */ |
48 |
|
float *bsdf; /* scattering distribution data */ |
49 |
|
}; /* bidirectional scattering distrib. func. */ |
50 |
|
|
51 |
|
struct illum_args { |
52 |
|
int flags; /* flags from list above */ |
53 |
|
UpDir udir; /* up direction */ |
54 |
+ |
double thick; /* object thickness */ |
55 |
|
char matname[MAXSTR]; /* illum material name */ |
56 |
|
char datafile[MAXSTR]; /* distribution data file name */ |
57 |
|
int dfnum; /* data file number */ |
64 |
|
COLOR col; /* computed average color */ |
65 |
|
}; /* illum options */ |
66 |
|
|
67 |
< |
#define getBSDF_incvec(v,b,i) decodedir(v, (b)->inc_dir[i]) |
68 |
< |
#define getBSDF_outvec(v,b,o) decodedir(v, (b)->out_dir[o]) |
69 |
< |
#define getBSDF_incrad(b,i) ((b)->om_scale*((b)->inc_rad[i] + .5)); |
70 |
< |
#define getBSDF_outrad(b,o) ((b)->om_scale*((b)->out_rad[o] + .5)); |
71 |
< |
#define BSDF_data(b,i,o) (b)->bsdf[(o)*(b)->ninc + (i)] |
67 |
> |
#define getBSDF_incvec(v,b,i) (*(b)->ib_vec)(v,i,(b)->ib_priv) |
68 |
> |
#define getBSDF_incndx(b,v) (*(b)->ib_ndx)(v,(b)->ib_priv) |
69 |
> |
#define getBSDF_incrad(b,i) (*(b)->ib_rad)(i,(b)->ib_priv) |
70 |
> |
#define getBSDF_outvec(v,b,o) (*(b)->ob_vec)(v,o,(b)->ob_priv) |
71 |
> |
#define getBSDF_outndx(b,v) (*(b)->ob_ndx)(v,(b)->ob_priv) |
72 |
> |
#define getBSDF_outrad(b,o) (*(b)->ob_rad)(o,(b)->ob_priv) |
73 |
> |
#define BSDF_visible(b,i,o) (b)->bsdf[(o)*(b)->ninc + (i)] |
74 |
|
|
75 |
|
extern struct BSDF_data *load_BSDF(char *fname); |
76 |
|
extern void free_BSDF(struct BSDF_data *b); |
78 |
|
double rv, MAT4 xm); |
79 |
|
extern void r_BSDF_outvec(FVECT v, struct BSDF_data *b, int o, |
80 |
|
double rv, MAT4 xm); |
81 |
+ |
extern int getBSDF_xfm(MAT4 xm, FVECT nrm, UpDir ud); |
82 |
+ |
extern void redistribute(struct BSDF_data *b, int nalt, int nazi, |
83 |
+ |
FVECT u, FVECT v, FVECT w, MAT4 xm); |
84 |
|
|
85 |
|
extern void printobj(char *mod, OBJREC *obj); |
86 |
|
extern int average(struct illum_args *il, COLORV *da, int n); |
89 |
|
extern void illumout(struct illum_args *il, OBJREC *ob); |
90 |
|
extern void roundout(struct illum_args *il, COLORV *da, int n, int m); |
91 |
|
|
92 |
+ |
extern void newdist(int siz); |
93 |
+ |
extern int process_ray(RAY *r, int rv); |
94 |
+ |
extern void raysamp(int ndx, FVECT org, FVECT dir); |
95 |
+ |
extern void rayclean(void); |
96 |
+ |
|
97 |
+ |
extern void flatdir(FVECT dv, double alt, double azi); |
98 |
+ |
|
99 |
|
extern int my_default(OBJREC *, struct illum_args *, char *); |
100 |
|
extern int my_face(OBJREC *, struct illum_args *, char *); |
101 |
|
extern int my_sphere(OBJREC *, struct illum_args *, char *); |
102 |
|
extern int my_ring(OBJREC *, struct illum_args *, char *); |
103 |
+ |
|
104 |
+ |
extern COLORV * distarr; /* distribution array */ |
105 |
+ |
extern int distsiz; |
106 |
|
|
107 |
|
extern char *progname; |
108 |
|
|