ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/ambient.h
Revision: 2.12
Committed: Tue Apr 19 01:15:06 2005 UTC (19 years ago) by greg
Content type: text/plain
Branch: MAIN
Changes since 2.11: +12 -10 lines
Log Message:
Extensive changes to enable rtrace -oTW option for tracking ray contributions

File Contents

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