ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/ray.h
Revision: 2.18
Committed: Thu Jun 26 00:58:10 2003 UTC (21 years, 4 months ago) by schorsch
Content type: text/plain
Branch: MAIN
Changes since 2.17: +2 -2 lines
Log Message:
Abstracted process and path handling for Windows.
Renamed FLOAT to RREAL because of conflict on Windows.
Added conditional compiles for some signal handlers.

File Contents

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