ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/ray.h
Revision: 2.24
Committed: Fri Apr 15 04:44:51 2005 UTC (19 years, 6 months ago) by greg
Content type: text/plain
Branch: MAIN
Changes since 2.23: +3 -6 lines
Log Message:
Eliminated revf member from RAY struct, as it was never really needed

File Contents

# Content
1 /* RCSid $Id: ray.h,v 2.23 2004/11/05 17:36:55 greg Exp $ */
2 /*
3 * ray.h - header file for routines using rays.
4 */
5 #ifndef _RAD_RAY_H_
6 #define _RAD_RAY_H_
7
8 #include "standard.h"
9 #include "octree.h"
10 #include "object.h"
11 #include "color.h"
12
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16
17 #define MAXDIM 32 /* maximum number of dimensions */
18
19 /* ray type flags */
20 #define PRIMARY 01 /* original ray */
21 #define SHADOW 02 /* ray to light source */
22 #define REFLECTED 04 /* reflected ray */
23 #define REFRACTED 010 /* refracted (bent) ray */
24 #define TRANS 020 /* transmitted/transferred ray */
25 #define AMBIENT 040 /* ray scattered for interreflection */
26 #define SPECULAR 0100 /* ray scattered for specular */
27
28 /* reflected ray types */
29 #define RAYREFL (SHADOW|REFLECTED|AMBIENT|SPECULAR)
30
31 typedef struct ray {
32 unsigned long rno; /* unique ray number */
33 int rlvl; /* number of reflections for this ray */
34 float rweight; /* cumulative weight of this ray */
35 short rtype; /* ray type */
36 short crtype; /* cumulative ray type */
37 struct ray *parent; /* ray this originated from */
38 FVECT rorg; /* origin of ray */
39 FVECT rdir; /* normalized direction of ray */
40 double rmax; /* maximum distance (aft clipping plane) */
41 int rsrc; /* source we're aiming for */
42 OBJECT *clipset; /* set of objects currently clipped */
43 OBJECT *newcset; /* next clipset, used for transmission */
44 void (*hitf)(OBJECT *, struct ray *); /* custom hit test */
45 OBJECT robj; /* intersected object number */
46 OBJREC *ro; /* intersected object (one with material) */
47 double rot; /* distance to object */
48 FVECT rop; /* intersection point */
49 FVECT ron; /* intersection surface normal */
50 double rod; /* -DOT(rdir, ron) */
51 FULLXF *rox; /* object transformation */
52 RREAL uv[2]; /* local coordinates */
53 FVECT pert; /* surface normal perturbation */
54 COLOR pcol; /* pattern color */
55 COLOR rcol; /* returned radiance value */
56 double rt; /* returned effective ray length */
57 COLOR cext; /* medium extinction coefficient */
58 COLOR albedo; /* medium scattering albedo */
59 float gecc; /* scattering eccentricity coefficient */
60 int *slights; /* list of lights to test for scattering */
61 } RAY;
62
63 extern char VersionID[]; /* Radiance version ID string */
64
65 extern CUBE thescene; /* our scene */
66 extern OBJECT nsceneobjs; /* number of objects in our scene */
67
68 extern unsigned long raynum; /* next ray ID */
69 extern unsigned long nrays; /* total rays traced so far */
70
71 extern OBJREC Lamb; /* a Lambertian surface */
72 extern OBJREC Aftplane; /* aft clipping object */
73
74 extern void (*trace)(); /* global trace reporting callback */
75
76 extern int dimlist[]; /* dimension list for distribution */
77 extern int ndims; /* number of dimensions so far */
78 extern int samplendx; /* index for this sample */
79
80 extern int ray_savesiz; /* size of parameter save buffer */
81
82 extern int do_irrad; /* compute irradiance? */
83
84 extern double dstrsrc; /* square source distribution */
85 extern double shadthresh; /* shadow threshold */
86 extern double shadcert; /* shadow testing certainty */
87 extern int directrelay; /* number of source relays */
88 extern int vspretest; /* virtual source pretest density */
89 extern int directvis; /* light sources visible to eye? */
90 extern double srcsizerat; /* maximum source size/dist. ratio */
91
92 extern double specthresh; /* specular sampling threshold */
93 extern double specjitter; /* specular sampling jitter */
94
95 extern COLOR cextinction; /* global extinction coefficient */
96 extern COLOR salbedo; /* global scattering albedo */
97 extern double seccg; /* global scattering eccentricity */
98 extern double ssampdist; /* scatter sampling distance */
99
100 extern int backvis; /* back face visibility */
101
102 extern int maxdepth; /* maximum recursion depth */
103 extern double minweight; /* minimum ray weight */
104
105 extern char *ambfile; /* ambient file name */
106 extern COLOR ambval; /* ambient value */
107 extern int ambvwt; /* initial weight for ambient value */
108 extern double ambacc; /* ambient accuracy */
109 extern int ambres; /* ambient resolution */
110 extern int ambdiv; /* ambient divisions */
111 extern int ambssamp; /* ambient super-samples */
112 extern int ambounce; /* ambient bounces */
113 extern char *amblist[]; /* ambient include/exclude list */
114 extern int ambincl; /* include == 1, exclude == 0 */
115
116 extern int ray_pnprocs; /* number of child processes */
117 extern int ray_pnidle; /* number of idle processes */
118
119 #ifndef AMBLLEN
120 #define AMBLLEN 512 /* max. ambient list length */
121 #endif
122 #define AMBWORD 12 /* average word length */
123
124 typedef struct { /* rendering parameter holder */
125 int do_irrad;
126 double dstrsrc;
127 double shadthresh;
128 double shadcert;
129 int directrelay;
130 int vspretest;
131 int directvis;
132 double srcsizerat;
133 COLOR cextinction;
134 COLOR salbedo;
135 double seccg;
136 double ssampdist;
137 double specthresh;
138 double specjitter;
139 int backvis;
140 int maxdepth;
141 double minweight;
142 char ambfile[512];
143 COLOR ambval;
144 int ambvwt;
145 double ambacc;
146 int ambres;
147 int ambdiv;
148 int ambssamp;
149 int ambounce;
150 int ambincl;
151 short amblndx[AMBLLEN+1];
152 char amblval[AMBLLEN*AMBWORD];
153 } RAYPARAMS;
154
155 #define rpambmod(p,i) ( (i)>=AMBLLEN||(p)->amblndx[i]<0 ? \
156 (char *)NULL : (p)->amblval+(p)->amblndx[i] )
157
158 /* defined in duphead.c */
159 extern void headclean(void);
160 extern void openheader(void);
161 extern void dupheader(void);
162 /* defined in persist.c */
163 extern void persistfile(char *pfn);
164 extern void pfdetach(void);
165 extern void pfclean(void);
166 extern void pflock(int lf);
167 extern void pfhold(void);
168 extern void io_process(void);
169 /* defined in freeobjmem.c */
170 extern int free_objs(OBJECT on, OBJECT no);
171 extern void free_objmem(void);
172 /* defined in preload.c */
173 extern int load_os(OBJREC *op);
174 extern void preload_objs(void);
175 /* defined in raycalls.c */
176 extern void ray_init(char *otnm);
177 extern void ray_trace(RAY *r);
178 extern void ray_done(int freall);
179 extern void ray_save(RAYPARAMS *rp);
180 extern void ray_restore(RAYPARAMS *rp);
181 extern void ray_defaults(RAYPARAMS *rp);
182 /* defined in raypcalls.c */
183 extern void ray_pinit(char *otnm, int nproc);
184 extern void ray_psend(RAY *r);
185 extern int ray_pqueue(RAY *r);
186 extern int ray_presult(RAY *r, int poll);
187 extern void ray_pdone(int freall);
188 extern void ray_popen(int nadd);
189 extern void ray_pclose(int nsub);
190 /* defined in raytrace.c */
191 extern int rayorigin(RAY *r, RAY *ro, int rt, double rw);
192 extern void rayclear(RAY *r);
193 extern void rayvalue(RAY *r);
194 extern void rayhit(OBJECT *oset, RAY *r);
195 extern void raycont(RAY *r);
196 extern void raytrans(RAY *r);
197 extern int rayshade(RAY *r, int mod);
198 extern void rayparticipate(RAY *r);
199 extern void raytexture(RAY *r, OBJECT mod);
200 extern int raymixture(RAY *r, OBJECT fore, OBJECT back, double coef);
201 extern double raydist(RAY *r, int flags);
202 extern double raynormal(FVECT norm, RAY *r);
203 extern void newrayxf(RAY *r);
204 extern void flipsurface(RAY *r);
205 extern int localhit(RAY *r, CUBE *scene);
206 /* defined in renderopts.c */
207 extern int getrenderopt(int ac, char *av[]);
208 extern void print_rdefaults(void);
209 /* defined in srcdraw.c */
210 extern void drawsources(COLOR *pic[], float *zbf[],
211 int x0, int xsiz, int y0, int ysiz);
212 extern void init_drawsources(int rad);
213 /* defined in rt/initotypes.c */
214 extern void initotypes(void);
215 /* module main procedures */
216 extern void rtrace(char *fname);
217 extern char * formstr(int f);
218 extern void rview(void);
219 extern void rpict(int seq, char *pout, char *zout, char *prvr);
220
221
222 #ifdef __cplusplus
223 }
224 #endif
225 #endif /* _RAD_RAY_H_ */
226