ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/gen/mkillum.h
Revision: 2.15
Committed: Wed Dec 12 05:09:58 2007 UTC (16 years, 3 months ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: rad3R9
Changes since 2.14: +2 -2 lines
Log Message:
Initial implementation of BSDF complete (untested)

File Contents

# User Rev Content
1 greg 2.15 /* RCSid: $Id: mkillum.h,v 2.14 2007/12/08 01:43:09 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 greg 2.14 #include "random.h"
11 schorsch 2.4
12     #ifdef __cplusplus
13     extern "C" {
14     #endif
15 greg 1.1 /* illum flags */
16 greg 1.3 #define IL_LIGHT 0x1 /* light rather than illum */
17     #define IL_COLDST 0x2 /* use color distribution */
18     #define IL_COLAVG 0x4 /* use average color */
19     #define IL_DATCLB 0x8 /* OK to clobber data file */
20 greg 1.1
21 greg 2.10 /* up directions */
22     typedef enum {
23     UDzneg=-3,
24     UDyneg=-2,
25     UDxneg=-1,
26     UDunknown=0,
27     UDxpos=1,
28     UDypos=2,
29     UDzpos=3
30     } UpDir;
31 greg 2.13 /* BSDF coordinate calculation routines */
32     /* vectors always point away from surface */
33 greg 2.14 typedef int b_vecf(FVECT, int, void *);
34     typedef int b_ndxf(FVECT, void *);
35     typedef double b_radf(int, void *);
36 greg 2.10
37 greg 2.13 /* Bidirectional Scattering Distribution Function */
38 greg 2.10 struct BSDF_data {
39     int ninc; /* number of incoming directions */
40     int nout; /* number of outgoing directions */
41 greg 2.14 void *ib_priv; /* input basis private data */
42 greg 2.13 b_vecf *ib_vec; /* get input vector from index */
43     b_ndxf *ib_ndx; /* get input index from vector */
44 greg 2.14 b_radf *ib_ohm; /* get input radius for index */
45     void *ob_priv; /* output basis private data */
46 greg 2.13 b_vecf *ob_vec; /* get output vector from index */
47     b_ndxf *ob_ndx; /* get output index from vector */
48 greg 2.14 b_radf *ob_ohm; /* get output radius for index */
49 greg 2.10 float *bsdf; /* scattering distribution data */
50     }; /* bidirectional scattering distrib. func. */
51    
52 greg 1.1 struct illum_args {
53     int flags; /* flags from list above */
54 greg 2.10 UpDir udir; /* up direction */
55 greg 2.11 double thick; /* object thickness */
56 greg 1.1 char matname[MAXSTR]; /* illum material name */
57     char datafile[MAXSTR]; /* distribution data file name */
58     int dfnum; /* data file number */
59 greg 1.2 char altmat[MAXSTR]; /* alternate material name */
60 greg 1.3 int sampdens; /* point sample density */
61 greg 1.1 int nsamps; /* # of samples in each direction */
62 greg 2.10 struct BSDF_data
63     *sd; /* scattering data (if set) */
64 greg 1.5 float minbrt; /* minimum average brightness */
65 greg 2.9 COLOR col; /* computed average color */
66 greg 1.1 }; /* illum options */
67    
68 greg 2.13 #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 greg 2.14 #define getBSDF_incohm(b,i) (*(b)->ib_ohm)(i,(b)->ib_priv)
71 greg 2.13 #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 greg 2.14 #define getBSDF_outohm(b,o) (*(b)->ob_ohm)(o,(b)->ob_priv)
74 greg 2.15 #define BSDF_value(b,i,o) (b)->bsdf[(o)*(b)->ninc + (i)]
75 greg 2.10
76     extern struct BSDF_data *load_BSDF(char *fname);
77     extern void free_BSDF(struct BSDF_data *b);
78 greg 2.14 extern int r_BSDF_incvec(FVECT v, struct BSDF_data *b, int i,
79 greg 2.10 double rv, MAT4 xm);
80 greg 2.14 extern int r_BSDF_outvec(FVECT v, struct BSDF_data *b, int o,
81 greg 2.10 double rv, MAT4 xm);
82 greg 2.11 extern int getBSDF_xfm(MAT4 xm, FVECT nrm, UpDir ud);
83     extern void redistribute(struct BSDF_data *b, int nalt, int nazi,
84     FVECT u, FVECT v, FVECT w, MAT4 xm);
85 greg 2.10
86     extern void printobj(char *mod, OBJREC *obj);
87     extern int average(struct illum_args *il, COLORV *da, int n);
88 greg 2.9 extern void flatout(struct illum_args *il, COLORV *da, int n, int m,
89     FVECT u, FVECT v, FVECT w);
90 greg 2.10 extern void illumout(struct illum_args *il, OBJREC *ob);
91 greg 2.9 extern void roundout(struct illum_args *il, COLORV *da, int n, int m);
92 schorsch 2.3
93 greg 2.11 extern void newdist(int siz);
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 greg 2.13 extern void flatdir(FVECT dv, double alt, double azi);
99    
100 greg 2.8 extern int my_default(OBJREC *, struct illum_args *, char *);
101     extern int my_face(OBJREC *, struct illum_args *, char *);
102     extern int my_sphere(OBJREC *, struct illum_args *, char *);
103     extern int my_ring(OBJREC *, struct illum_args *, char *);
104 greg 2.7
105 greg 2.11 extern COLORV * distarr; /* distribution array */
106     extern int distsiz;
107    
108 greg 2.8 extern char *progname;
109 greg 2.7
110     #ifdef __cplusplus
111     }
112     #endif
113 greg 2.6
114 schorsch 2.3 #endif /* _RAD_MKILLUM_H_ */
115