| 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 "standard.h" |
| 10 |
< |
|
| 11 |
< |
#include "object.h" |
| 12 |
< |
|
| 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 |
+ |
|
| 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 |
+ |
|
| 43 |
|
struct illum_args { |
| 44 |
|
int flags; /* flags from list above */ |
| 45 |
+ |
UpDir udir; /* up direction */ |
| 46 |
+ |
double thick; /* object thickness */ |
| 47 |
|
char matname[MAXSTR]; /* illum material name */ |
| 48 |
|
char datafile[MAXSTR]; /* distribution data file name */ |
| 49 |
|
int dfnum; /* data file number */ |
| 50 |
|
char altmat[MAXSTR]; /* alternate material name */ |
| 51 |
|
int sampdens; /* point sample density */ |
| 52 |
|
int nsamps; /* # of samples in each direction */ |
| 53 |
+ |
struct BSDF_data |
| 54 |
+ |
*sd; /* scattering data (if set) */ |
| 55 |
|
float minbrt; /* minimum average brightness */ |
| 56 |
< |
float col[3]; /* computed average color */ |
| 56 |
> |
COLOR col; /* computed average color */ |
| 57 |
|
}; /* illum options */ |
| 58 |
|
|
| 59 |
< |
struct rtproc { |
| 60 |
< |
int pd[3]; /* rtrace pipe descriptors */ |
| 61 |
< |
float *buf; /* rtrace i/o buffer */ |
| 62 |
< |
int bsiz; /* maximum rays for rtrace buffer */ |
| 63 |
< |
float **dest; /* destination for each ray result */ |
| 64 |
< |
int nrays; /* current length of rtrace buffer */ |
| 65 |
< |
}; /* rtrace process */ |
| 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); |
| 72 |
> |
extern void redistribute(struct BSDF_data *b, int nalt, int nazi, |
| 73 |
> |
FVECT u, FVECT v, FVECT w, MAT4 xm); |
| 74 |
> |
|
| 75 |
> |
extern void printobj(char *mod, OBJREC *obj); |
| 76 |
> |
extern int average(struct illum_args *il, COLORV *da, int n); |
| 77 |
> |
extern void flatout(struct illum_args *il, COLORV *da, int n, int m, |
| 78 |
> |
FVECT u, FVECT v, FVECT w); |
| 79 |
> |
extern void illumout(struct illum_args *il, OBJREC *ob); |
| 80 |
> |
extern void roundout(struct illum_args *il, COLORV *da, int n, int m); |
| 81 |
> |
|
| 82 |
> |
extern void newdist(int siz); |
| 83 |
> |
extern int process_ray(RAY *r, int rv); |
| 84 |
> |
extern void raysamp(int ndx, FVECT org, FVECT dir); |
| 85 |
> |
extern void rayclean(void); |
| 86 |
> |
|
| 87 |
> |
extern int my_default(OBJREC *, struct illum_args *, char *); |
| 88 |
> |
extern int my_face(OBJREC *, struct illum_args *, char *); |
| 89 |
> |
extern int my_sphere(OBJREC *, struct illum_args *, char *); |
| 90 |
> |
extern int my_ring(OBJREC *, struct illum_args *, char *); |
| 91 |
> |
|
| 92 |
> |
extern COLORV * distarr; /* distribution array */ |
| 93 |
> |
extern int distsiz; |
| 94 |
> |
|
| 95 |
> |
extern char *progname; |
| 96 |
> |
|
| 97 |
> |
#ifdef __cplusplus |
| 98 |
> |
} |
| 99 |
> |
#endif |
| 100 |
> |
|
| 101 |
> |
#endif /* _RAD_MKILLUM_H_ */ |
| 102 |
> |
|