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

# User Rev Content
1 greg 2.13 /* RCSid: $Id: mkillum.h,v 2.12 2007/11/05 23:40:26 greg Exp $ */
2 greg 1.1 /*
3     * Common definitions for mkillum
4     */
5 schorsch 2.3 #ifndef _RAD_MKILLUM_H_
6     #define _RAD_MKILLUM_H_
7 greg 1.2
8 greg 2.8 #include "ray.h"
9     #include "otypes.h"
10 schorsch 2.4
11     #ifdef __cplusplus
12     extern "C" {
13     #endif
14 greg 1.1 /* illum flags */
15 greg 1.3 #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 greg 1.1
20 greg 2.10 /* 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 greg 2.13 /* 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 greg 2.10
36 greg 2.13 /* Bidirectional Scattering Distribution Function */
37 greg 2.10 struct BSDF_data {
38     int ninc; /* number of incoming directions */
39     int nout; /* number of outgoing directions */
40 greg 2.13 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 greg 2.10 float *bsdf; /* scattering distribution data */
49     }; /* bidirectional scattering distrib. func. */
50    
51 greg 1.1 struct illum_args {
52     int flags; /* flags from list above */
53 greg 2.10 UpDir udir; /* up direction */
54 greg 2.11 double thick; /* object thickness */
55 greg 1.1 char matname[MAXSTR]; /* illum material name */
56     char datafile[MAXSTR]; /* distribution data file name */
57     int dfnum; /* data file number */
58 greg 1.2 char altmat[MAXSTR]; /* alternate material name */
59 greg 1.3 int sampdens; /* point sample density */
60 greg 1.1 int nsamps; /* # of samples in each direction */
61 greg 2.10 struct BSDF_data
62     *sd; /* scattering data (if set) */
63 greg 1.5 float minbrt; /* minimum average brightness */
64 greg 2.9 COLOR col; /* computed average color */
65 greg 1.1 }; /* illum options */
66    
67 greg 2.13 #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 greg 2.10
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 greg 2.11 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 greg 2.10
85     extern void printobj(char *mod, OBJREC *obj);
86     extern int average(struct illum_args *il, COLORV *da, int n);
87 greg 2.9 extern void flatout(struct illum_args *il, COLORV *da, int n, int m,
88     FVECT u, FVECT v, FVECT w);
89 greg 2.10 extern void illumout(struct illum_args *il, OBJREC *ob);
90 greg 2.9 extern void roundout(struct illum_args *il, COLORV *da, int n, int m);
91 schorsch 2.3
92 greg 2.11 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 greg 2.13 extern void flatdir(FVECT dv, double alt, double azi);
98    
99 greg 2.8 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 greg 2.7
104 greg 2.11 extern COLORV * distarr; /* distribution array */
105     extern int distsiz;
106    
107 greg 2.8 extern char *progname;
108 greg 2.7
109     #ifdef __cplusplus
110     }
111     #endif
112 greg 2.6
113 schorsch 2.3 #endif /* _RAD_MKILLUM_H_ */
114