1 |
< |
/* Copyright (c) 1991 Regents of the University of California */ |
2 |
< |
|
3 |
< |
/* SCCSid "$SunId$ LBL" */ |
4 |
< |
|
1 |
> |
/* RCSid: $Id$ */ |
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_FLAT 0x1 /* flat surface */ |
16 |
< |
#define IL_LIGHT 0x2 /* light rather than illum */ |
17 |
< |
#define IL_COLDST 0x4 /* colored distribution */ |
18 |
< |
#define IL_COLAVG 0x8 /* compute average color */ |
13 |
< |
#define IL_DATCLB 0x10 /* OK to clobber data file */ |
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 |
+ |
|
31 |
+ |
struct BSDF_data { |
32 |
+ |
double om_scale; /* maximum solid angle (sr/256) */ |
33 |
+ |
int ninc; /* number of incoming directions */ |
34 |
+ |
int32 *inc_dir; /* incoming direction codes */ |
35 |
+ |
BYTE *inc_rad; /* incoming radians to neighbor */ |
36 |
+ |
int nout; /* number of outgoing directions */ |
37 |
+ |
int32 *out_dir; /* outgoing direction codes */ |
38 |
+ |
BYTE *out_rad; /* outgoing radians to neighbor */ |
39 |
+ |
float *bsdf; /* scattering distribution data */ |
40 |
+ |
}; /* bidirectional scattering distrib. func. */ |
41 |
+ |
|
42 |
|
struct illum_args { |
43 |
|
int flags; /* flags from list above */ |
44 |
+ |
UpDir udir; /* up direction */ |
45 |
|
char matname[MAXSTR]; /* illum material name */ |
46 |
|
char datafile[MAXSTR]; /* distribution data file name */ |
47 |
|
int dfnum; /* data file number */ |
48 |
< |
char altmatname[MAXSTR]; /* alternate material name */ |
48 |
> |
char altmat[MAXSTR]; /* alternate material name */ |
49 |
> |
int sampdens; /* point sample density */ |
50 |
|
int nsamps; /* # of samples in each direction */ |
51 |
< |
int nalt, nazi; /* # of altitude and azimuth angles */ |
52 |
< |
FVECT orient; /* coordinate system orientation */ |
51 |
> |
struct BSDF_data |
52 |
> |
*sd; /* scattering data (if set) */ |
53 |
> |
float minbrt; /* minimum average brightness */ |
54 |
> |
COLOR col; /* computed average color */ |
55 |
|
}; /* illum options */ |
56 |
|
|
57 |
< |
struct rtproc { |
58 |
< |
int pd[3]; /* rtrace pipe descriptors */ |
59 |
< |
float *buf; /* rtrace i/o buffer */ |
60 |
< |
int bsiz; /* maximum rays for rtrace buffer */ |
61 |
< |
int nrays; /* current length of rtrace buffer */ |
62 |
< |
}; /* rtrace process */ |
57 |
> |
#define getBSDF_incvec(v,b,i) decodedir(v, (b)->inc_dir[i]) |
58 |
> |
#define getBSDF_outvec(v,b,o) decodedir(v, (b)->out_dir[o]) |
59 |
> |
#define getBSDF_incrad(b,i) ((b)->om_scale*((b)->inc_rad[i] + .5)); |
60 |
> |
#define getBSDF_outrad(b,o) ((b)->om_scale*((b)->out_rad[o] + .5)); |
61 |
> |
#define BSDF_data(b,i,o) (b)->bsdf[(o)*(b)->ninc + (i)] |
62 |
> |
|
63 |
> |
extern struct BSDF_data *load_BSDF(char *fname); |
64 |
> |
extern void free_BSDF(struct BSDF_data *b); |
65 |
> |
extern void r_BSDF_incvec(FVECT v, struct BSDF_data *b, int i, |
66 |
> |
double rv, MAT4 xm); |
67 |
> |
extern void r_BSDF_outvec(FVECT v, struct BSDF_data *b, int o, |
68 |
> |
double rv, MAT4 xm); |
69 |
> |
|
70 |
> |
extern void printobj(char *mod, OBJREC *obj); |
71 |
> |
extern int average(struct illum_args *il, COLORV *da, int n); |
72 |
> |
extern void flatout(struct illum_args *il, COLORV *da, int n, int m, |
73 |
> |
FVECT u, FVECT v, FVECT w); |
74 |
> |
extern void illumout(struct illum_args *il, OBJREC *ob); |
75 |
> |
extern void roundout(struct illum_args *il, COLORV *da, int n, int m); |
76 |
> |
|
77 |
> |
extern int my_default(OBJREC *, struct illum_args *, char *); |
78 |
> |
extern int my_face(OBJREC *, struct illum_args *, char *); |
79 |
> |
extern int my_sphere(OBJREC *, struct illum_args *, char *); |
80 |
> |
extern int my_ring(OBJREC *, struct illum_args *, char *); |
81 |
> |
|
82 |
> |
extern char *progname; |
83 |
> |
|
84 |
> |
#ifdef __cplusplus |
85 |
> |
} |
86 |
> |
#endif |
87 |
> |
|
88 |
> |
#endif /* _RAD_MKILLUM_H_ */ |
89 |
> |
|