7 |
|
|
8 |
|
#include "ray.h" |
9 |
|
#include "otypes.h" |
10 |
+ |
#include "random.h" |
11 |
|
|
12 |
|
#ifdef __cplusplus |
13 |
|
extern "C" { |
28 |
|
UDypos=2, |
29 |
|
UDzpos=3 |
30 |
|
} UpDir; |
31 |
+ |
/* BSDF coordinate calculation routines */ |
32 |
+ |
/* vectors always point away from surface */ |
33 |
+ |
typedef int b_vecf(FVECT, int, void *); |
34 |
+ |
typedef int b_ndxf(FVECT, void *); |
35 |
+ |
typedef double b_radf(int, void *); |
36 |
|
|
37 |
< |
/* XXX need to add per-band data */ |
37 |
> |
/* Bidirectional Scattering Distribution Function */ |
38 |
|
struct BSDF_data { |
33 |
– |
double om_scale; /* maximum solid angle (sr/256) */ |
39 |
|
int ninc; /* number of incoming directions */ |
35 |
– |
int32 *inc_dir; /* incoming direction codes */ |
36 |
– |
BYTE *inc_rad; /* incoming radians to neighbor */ |
40 |
|
int nout; /* number of outgoing directions */ |
41 |
< |
int32 *out_dir; /* outgoing direction codes */ |
42 |
< |
BYTE *out_rad; /* outgoing radians to neighbor */ |
41 |
> |
void *ib_priv; /* input basis private data */ |
42 |
> |
b_vecf *ib_vec; /* get input vector from index */ |
43 |
> |
b_ndxf *ib_ndx; /* get input index from vector */ |
44 |
> |
b_radf *ib_ohm; /* get input radius for index */ |
45 |
> |
void *ob_priv; /* output basis private data */ |
46 |
> |
b_vecf *ob_vec; /* get output vector from index */ |
47 |
> |
b_ndxf *ob_ndx; /* get output index from vector */ |
48 |
> |
b_radf *ob_ohm; /* get output radius for index */ |
49 |
|
float *bsdf; /* scattering distribution data */ |
50 |
|
}; /* bidirectional scattering distrib. func. */ |
51 |
|
|
65 |
|
COLOR col; /* computed average color */ |
66 |
|
}; /* illum options */ |
67 |
|
|
68 |
< |
#define getBSDF_incvec(v,b,i) decodedir(v, (b)->inc_dir[i]) |
69 |
< |
#define getBSDF_outvec(v,b,o) decodedir(v, (b)->out_dir[o]) |
70 |
< |
#define getBSDF_incrad(b,i) ((b)->om_scale*((b)->inc_rad[i] + .5)); |
71 |
< |
#define getBSDF_outrad(b,o) ((b)->om_scale*((b)->out_rad[o] + .5)); |
72 |
< |
#define BSDF_data(b,i,o) (b)->bsdf[(o)*(b)->ninc + (i)] |
68 |
> |
#define getBSDF_incvec(v,b,i) (*(b)->ib_vec)(v,i,(b)->ib_priv) |
69 |
> |
#define getBSDF_incndx(b,v) (*(b)->ib_ndx)(v,(b)->ib_priv) |
70 |
> |
#define getBSDF_incohm(b,i) (*(b)->ib_ohm)(i,(b)->ib_priv) |
71 |
> |
#define getBSDF_outvec(v,b,o) (*(b)->ob_vec)(v,o,(b)->ob_priv) |
72 |
> |
#define getBSDF_outndx(b,v) (*(b)->ob_ndx)(v,(b)->ob_priv) |
73 |
> |
#define getBSDF_outohm(b,o) (*(b)->ob_ohm)(o,(b)->ob_priv) |
74 |
> |
#define BSDF_visible(b,i,o) (b)->bsdf[(o)*(b)->ninc + (i)] |
75 |
|
|
76 |
|
extern struct BSDF_data *load_BSDF(char *fname); |
77 |
|
extern void free_BSDF(struct BSDF_data *b); |
78 |
< |
extern void r_BSDF_incvec(FVECT v, struct BSDF_data *b, int i, |
78 |
> |
extern int r_BSDF_incvec(FVECT v, struct BSDF_data *b, int i, |
79 |
|
double rv, MAT4 xm); |
80 |
< |
extern void r_BSDF_outvec(FVECT v, struct BSDF_data *b, int o, |
80 |
> |
extern int r_BSDF_outvec(FVECT v, struct BSDF_data *b, int o, |
81 |
|
double rv, MAT4 xm); |
82 |
|
extern int getBSDF_xfm(MAT4 xm, FVECT nrm, UpDir ud); |
83 |
|
extern void redistribute(struct BSDF_data *b, int nalt, int nazi, |
94 |
|
extern int process_ray(RAY *r, int rv); |
95 |
|
extern void raysamp(int ndx, FVECT org, FVECT dir); |
96 |
|
extern void rayclean(void); |
97 |
+ |
|
98 |
+ |
extern void flatdir(FVECT dv, double alt, double azi); |
99 |
|
|
100 |
|
extern int my_default(OBJREC *, struct illum_args *, char *); |
101 |
|
extern int my_face(OBJREC *, struct illum_args *, char *); |