| 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 |
– |
|
| 31 |
– |
/* XXX need to add per-band data */ |
| 32 |
– |
struct BSDF_data { |
| 33 |
– |
double om_scale; /* maximum solid angle (sr/256) */ |
| 34 |
– |
int ninc; /* number of incoming directions */ |
| 35 |
– |
int32 *inc_dir; /* incoming direction codes */ |
| 36 |
– |
BYTE *inc_rad; /* incoming radians to neighbor */ |
| 37 |
– |
int nout; /* number of outgoing directions */ |
| 38 |
– |
int32 *out_dir; /* outgoing direction codes */ |
| 39 |
– |
BYTE *out_rad; /* outgoing radians to neighbor */ |
| 40 |
– |
float *bsdf; /* scattering distribution data */ |
| 41 |
– |
}; /* bidirectional scattering distrib. func. */ |
| 42 |
– |
|
| 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 |
|
|
| 59 |
– |
#define getBSDF_incvec(v,b,i) decodedir(v, (b)->inc_dir[i]) |
| 60 |
– |
#define getBSDF_outvec(v,b,o) decodedir(v, (b)->out_dir[o]) |
| 61 |
– |
#define getBSDF_incrad(b,i) ((b)->om_scale*((b)->inc_rad[i] + .5)); |
| 62 |
– |
#define getBSDF_outrad(b,o) ((b)->om_scale*((b)->out_rad[o] + .5)); |
| 63 |
– |
#define BSDF_data(b,i,o) (b)->bsdf[(o)*(b)->ninc + (i)] |
| 64 |
– |
|
| 65 |
– |
extern struct BSDF_data *load_BSDF(char *fname); |
| 66 |
– |
extern void free_BSDF(struct BSDF_data *b); |
| 67 |
– |
extern void r_BSDF_incvec(FVECT v, struct BSDF_data *b, int i, |
| 68 |
– |
double rv, MAT4 xm); |
| 69 |
– |
extern void r_BSDF_outvec(FVECT v, struct BSDF_data *b, int o, |
| 70 |
– |
double rv, MAT4 xm); |
| 71 |
– |
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 |
|
|
| 50 |
|
extern void raysamp(int ndx, FVECT org, FVECT dir); |
| 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 *); |
| 58 |
|
extern int my_sphere(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 |
|
|