| 1 |
schorsch |
2.9 |
/* RCSid $Id: ambient.h,v 2.8 2003/02/25 02:47:22 greg Exp $ */ |
| 2 |
greg |
1.1 |
/* |
| 3 |
|
|
* Common definitions for interreflection routines. |
| 4 |
greg |
2.7 |
* |
| 5 |
|
|
* Include after ray.h |
| 6 |
|
|
*/ |
| 7 |
schorsch |
2.9 |
#ifndef _RAD_AMBIENT_H_ |
| 8 |
|
|
#define _RAD_AMBIENT_H_ |
| 9 |
|
|
#ifdef __cplusplus |
| 10 |
|
|
extern "C" { |
| 11 |
|
|
#endif |
| 12 |
|
|
|
| 13 |
greg |
2.7 |
|
| 14 |
greg |
2.8 |
#include "copyright.h" |
| 15 |
greg |
1.1 |
|
| 16 |
|
|
/* |
| 17 |
|
|
* Since we've defined our vectors as float below to save space, |
| 18 |
|
|
* watch out for changes in the definitions of VCOPY() and DOT() |
| 19 |
|
|
* and don't pass these vectors to fvect routines. |
| 20 |
|
|
*/ |
| 21 |
|
|
typedef struct ambrec { |
| 22 |
greg |
2.5 |
unsigned long latick; /* last accessed tick */ |
| 23 |
greg |
1.1 |
float pos[3]; /* position in space */ |
| 24 |
|
|
float dir[3]; /* normal direction */ |
| 25 |
|
|
int lvl; /* recursion level of parent ray */ |
| 26 |
|
|
float weight; /* weight of parent ray */ |
| 27 |
|
|
float rad; /* validity radius */ |
| 28 |
|
|
COLOR val; /* computed ambient value */ |
| 29 |
|
|
float gpos[3]; /* gradient wrt. position */ |
| 30 |
|
|
float gdir[3]; /* gradient wrt. direction */ |
| 31 |
|
|
struct ambrec *next; /* next in list */ |
| 32 |
|
|
} AMBVAL; /* ambient value */ |
| 33 |
|
|
|
| 34 |
greg |
2.7 |
typedef struct ambtree { |
| 35 |
|
|
AMBVAL *alist; /* ambient value list */ |
| 36 |
|
|
struct ambtree *kid; /* 8 child nodes */ |
| 37 |
|
|
} AMBTREE; /* ambient octree */ |
| 38 |
|
|
|
| 39 |
|
|
typedef struct { |
| 40 |
|
|
short t, p; /* theta, phi indices */ |
| 41 |
|
|
COLOR v; /* value sum */ |
| 42 |
|
|
float r; /* 1/distance sum */ |
| 43 |
|
|
float k; /* variance for this division */ |
| 44 |
|
|
int n; /* number of subsamples */ |
| 45 |
|
|
} AMBSAMP; /* ambient sample division */ |
| 46 |
|
|
|
| 47 |
|
|
typedef struct { |
| 48 |
|
|
FVECT ux, uy, uz; /* x, y and z axis directions */ |
| 49 |
|
|
short nt, np; /* number of theta and phi directions */ |
| 50 |
|
|
} AMBHEMI; /* ambient sample hemisphere */ |
| 51 |
|
|
|
| 52 |
greg |
1.1 |
extern double maxarad; /* maximum ambient radius */ |
| 53 |
|
|
extern double minarad; /* minimum ambient radius */ |
| 54 |
|
|
|
| 55 |
greg |
1.2 |
#define AVGREFL 0.5 /* assumed average reflectance */ |
| 56 |
greg |
2.2 |
|
| 57 |
|
|
#define AMBVALSIZ 75 /* number of bytes in portable AMBVAL struct */ |
| 58 |
greg |
2.4 |
#define AMBMAGIC 557 /* magic number for ambient value files */ |
| 59 |
greg |
2.3 |
#define AMBFMT "Radiance_ambval" /* format id string */ |
| 60 |
greg |
2.7 |
|
| 61 |
|
|
/* defined in ambcomp.c */ |
| 62 |
|
|
extern int divsample(AMBSAMP *dp, AMBHEMI *h, RAY *r); |
| 63 |
|
|
extern double doambient(COLOR acol, RAY *r, double wt, FVECT pg, FVECT dg); |
| 64 |
|
|
extern void inithemi(AMBHEMI *hp, RAY *r, double wt); |
| 65 |
|
|
extern void comperrs(AMBSAMP *da, AMBHEMI *hp); |
| 66 |
|
|
extern void posgradient(FVECT gv, AMBSAMP *da, AMBHEMI *hp); |
| 67 |
|
|
extern void dirgradient(FVECT gv, AMBSAMP *da, AMBHEMI *hp); |
| 68 |
|
|
/* defined in ambient.c */ |
| 69 |
|
|
extern void setambres(int ar); |
| 70 |
|
|
extern void setambacc(double newa); |
| 71 |
|
|
extern void setambient(void); |
| 72 |
|
|
extern void ambdone(void); |
| 73 |
|
|
extern void ambnotify(OBJECT obj); |
| 74 |
|
|
extern void ambient(COLOR acol, RAY *r, FVECT nrm); |
| 75 |
|
|
extern double sumambient(COLOR acol, RAY *r, FVECT rn, int al, |
| 76 |
|
|
AMBTREE *at, FVECT c0, double s); |
| 77 |
|
|
extern double makeambient(COLOR acol, RAY *r, FVECT rn, int al); |
| 78 |
|
|
extern void extambient(COLOR cr, AMBVAL *ap, FVECT pv, FVECT nv); |
| 79 |
|
|
extern int ambsync(void); |
| 80 |
|
|
/* defined in ambio.c */ |
| 81 |
|
|
extern void putambmagic(FILE *fp); |
| 82 |
|
|
extern int hasambmagic(FILE *fp); |
| 83 |
|
|
extern int writambval(AMBVAL *av, FILE *fp); |
| 84 |
|
|
extern int ambvalOK(AMBVAL *av); |
| 85 |
|
|
extern int readambval(AMBVAL *av, FILE *fp); |
| 86 |
|
|
/* defined in lookamb.c */ |
| 87 |
|
|
extern void lookamb(FILE *fp); |
| 88 |
|
|
extern void writamb(FILE *fp); |
| 89 |
|
|
|
| 90 |
schorsch |
2.9 |
|
| 91 |
|
|
#ifdef __cplusplus |
| 92 |
|
|
} |
| 93 |
greg |
2.7 |
#endif |
| 94 |
schorsch |
2.9 |
#endif /* _RAD_AMBIENT_H_ */ |
| 95 |
|
|
|