ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/gen/mkillum.h
Revision: 2.13
Committed: Wed Dec 5 20:07:34 2007 UTC (16 years, 4 months ago) by greg
Content type: text/plain
Branch: MAIN
Changes since 2.12: +24 -12 lines
Log Message:
Improved BSDF resampling

File Contents

# Content
1 /* RCSid: $Id: mkillum.h,v 2.12 2007/11/05 23:40:26 greg Exp $ */
2 /*
3 * Common definitions for mkillum
4 */
5 #ifndef _RAD_MKILLUM_H_
6 #define _RAD_MKILLUM_H_
7
8 #include "ray.h"
9 #include "otypes.h"
10
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 /* illum flags */
15 #define IL_LIGHT 0x1 /* light rather than illum */
16 #define IL_COLDST 0x2 /* use color distribution */
17 #define IL_COLAVG 0x4 /* use average color */
18 #define IL_DATCLB 0x8 /* OK to clobber data file */
19
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
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 */
58 char altmat[MAXSTR]; /* alternate material name */
59 int sampdens; /* point sample density */
60 int nsamps; /* # of samples in each direction */
61 struct BSDF_data
62 *sd; /* scattering data (if set) */
63 float minbrt; /* minimum average brightness */
64 COLOR col; /* computed average color */
65 }; /* illum options */
66
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);
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);
87 extern void flatout(struct illum_args *il, COLORV *da, int n, int m,
88 FVECT u, FVECT v, FVECT w);
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
109 #ifdef __cplusplus
110 }
111 #endif
112
113 #endif /* _RAD_MKILLUM_H_ */
114