7 |
|
|
8 |
|
#include "ray.h" |
9 |
|
#include "otypes.h" |
10 |
+ |
#include "bsdf.h" |
11 |
+ |
#include "random.h" |
12 |
|
|
13 |
|
#ifdef __cplusplus |
14 |
|
extern "C" { |
19 |
|
#define IL_COLAVG 0x4 /* use average color */ |
20 |
|
#define IL_DATCLB 0x8 /* OK to clobber data file */ |
21 |
|
|
20 |
– |
/* up directions */ |
21 |
– |
typedef enum { |
22 |
– |
UDzneg=-3, |
23 |
– |
UDyneg=-2, |
24 |
– |
UDxneg=-1, |
25 |
– |
UDunknown=0, |
26 |
– |
UDxpos=1, |
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 { |
38 |
– |
int ninc; /* number of incoming directions */ |
39 |
– |
int nout; /* number of outgoing directions */ |
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 |
– |
|
22 |
|
struct illum_args { |
23 |
|
int flags; /* flags from list above */ |
24 |
|
UpDir udir; /* up direction */ |
35 |
|
COLOR col; /* computed average color */ |
36 |
|
}; /* illum options */ |
37 |
|
|
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); |
77 |
– |
extern void r_BSDF_incvec(FVECT v, struct BSDF_data *b, int i, |
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); |
38 |
|
extern void redistribute(struct BSDF_data *b, int nalt, int nazi, |
39 |
|
FVECT u, FVECT v, FVECT w, MAT4 xm); |
40 |
|
|
51 |
|
extern void rayclean(void); |
52 |
|
|
53 |
|
extern void flatdir(FVECT dv, double alt, double azi); |
54 |
+ |
extern int flatindex(FVECT dv, int nalt, int nazi); |
55 |
|
|
56 |
|
extern int my_default(OBJREC *, struct illum_args *, char *); |
57 |
|
extern int my_face(OBJREC *, struct illum_args *, char *); |
60 |
|
|
61 |
|
extern COLORV * distarr; /* distribution array */ |
62 |
|
extern int distsiz; |
63 |
+ |
extern COLORV * direct_discount; /* amount to take off direct */ |
64 |
|
|
65 |
|
extern char *progname; |
66 |
|
|