2 |
|
/* |
3 |
|
* ray.h - header file for routines using rays. |
4 |
|
*/ |
5 |
+ |
#ifndef _RAD_RAY_H_ |
6 |
+ |
#define _RAD_RAY_H_ |
7 |
|
|
6 |
– |
#include "copyright.h" |
7 |
– |
|
8 |
|
#include "standard.h" |
9 |
– |
|
9 |
|
#include "octree.h" |
11 |
– |
|
10 |
|
#include "object.h" |
13 |
– |
|
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 */ |
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 */ |
34 |
> |
float rweight; /* cumulative weight (for termination) */ |
35 |
> |
COLOR rcoef; /* contribution coefficient w.r.t. parent */ |
36 |
|
short rtype; /* ray type */ |
37 |
|
short crtype; /* cumulative ray type */ |
38 |
< |
struct ray *parent; /* ray this originated from */ |
38 |
> |
const struct ray *parent; /* ray this originated from */ |
39 |
|
FVECT rorg; /* origin of ray */ |
40 |
|
FVECT rdir; /* normalized direction of ray */ |
41 |
|
double rmax; /* maximum distance (aft clipping plane) */ |
42 |
|
int rsrc; /* source we're aiming for */ |
43 |
|
OBJECT *clipset; /* set of objects currently clipped */ |
44 |
|
OBJECT *newcset; /* next clipset, used for transmission */ |
45 |
< |
void (*revf)(); /* evaluation function for this ray */ |
46 |
< |
void (*hitf)(); /* custom hit test for this traversal */ |
45 |
> |
void (*revf)(struct ray *); /* ray evaluation function */ |
46 |
> |
void (*hitf)(OBJECT *, struct ray *); /* custom hit test */ |
47 |
|
OBJECT robj; /* intersected object number */ |
48 |
|
OBJREC *ro; /* intersected object (one with material) */ |
49 |
|
double rot; /* distance to object */ |
51 |
|
FVECT ron; /* intersection surface normal */ |
52 |
|
double rod; /* -DOT(rdir, ron) */ |
53 |
|
FULLXF *rox; /* object transformation */ |
54 |
< |
FLOAT uv[2]; /* local coordinates */ |
54 |
> |
RREAL uv[2]; /* local coordinates */ |
55 |
|
FVECT pert; /* surface normal perturbation */ |
56 |
|
COLOR pcol; /* pattern color */ |
57 |
< |
COLOR rcol; /* returned ray value */ |
57 |
> |
COLOR rcol; /* returned radiance value */ |
58 |
|
double rt; /* returned effective ray length */ |
59 |
|
COLOR cext; /* medium extinction coefficient */ |
60 |
|
COLOR albedo; /* medium scattering albedo */ |
85 |
|
|
86 |
|
extern int do_irrad; /* compute irradiance? */ |
87 |
|
|
88 |
+ |
extern int rand_samp; /* pure Monte Carlo sampling? */ |
89 |
+ |
|
90 |
|
extern double dstrsrc; /* square source distribution */ |
91 |
|
extern double shadthresh; /* shadow threshold */ |
92 |
|
extern double shadcert; /* shadow testing certainty */ |
122 |
|
extern int ray_pnprocs; /* number of child processes */ |
123 |
|
extern int ray_pnidle; /* number of idle processes */ |
124 |
|
|
125 |
< |
#define AMBLLEN 128 /* max. ambient list length */ |
126 |
< |
#define AMBWORD 8 /* average word length */ |
125 |
> |
#ifndef AMBLLEN |
126 |
> |
#define AMBLLEN 512 /* max. ambient list length */ |
127 |
> |
#endif |
128 |
> |
#define AMBWORD 12 /* average word length */ |
129 |
|
|
130 |
|
typedef struct { /* rendering parameter holder */ |
131 |
|
int do_irrad; |
132 |
+ |
int rand_samp; |
133 |
|
double dstrsrc; |
134 |
|
double shadthresh; |
135 |
|
double shadcert; |
162 |
|
#define rpambmod(p,i) ( (i)>=AMBLLEN||(p)->amblndx[i]<0 ? \ |
163 |
|
(char *)NULL : (p)->amblval+(p)->amblndx[i] ) |
164 |
|
|
158 |
– |
#ifdef NOPROTO |
159 |
– |
|
160 |
– |
extern void headclean(); |
161 |
– |
extern void openheader(); |
162 |
– |
extern void dupheader(); |
163 |
– |
extern void pfdetach(); |
164 |
– |
extern void pfclean(); |
165 |
– |
extern void pflock(); |
166 |
– |
extern void pfhold(); |
167 |
– |
extern void io_process(); |
168 |
– |
extern int free_objs(); |
169 |
– |
extern void free_objmem(); |
170 |
– |
extern int load_os(); |
171 |
– |
extern void preload_objs(); |
172 |
– |
extern void ray_init(); |
173 |
– |
extern void ray_trace(); |
174 |
– |
extern void ray_done(); |
175 |
– |
extern void ray_save(); |
176 |
– |
extern void ray_restore(); |
177 |
– |
extern void ray_defaults(); |
178 |
– |
extern void ray_pinit(); |
179 |
– |
extern void ray_psend(); |
180 |
– |
extern int ray_pqueue(); |
181 |
– |
extern int ray_presult(); |
182 |
– |
extern void ray_pdone(); |
183 |
– |
extern void ray_popen(); |
184 |
– |
extern void ray_pclose(); |
185 |
– |
extern int rayorigin(); |
186 |
– |
extern void rayclear(); |
187 |
– |
extern void raytrace(); |
188 |
– |
extern void rayhit(); |
189 |
– |
extern void raycont(); |
190 |
– |
extern void raytrans(); |
191 |
– |
extern int rayshade(); |
192 |
– |
extern void rayparticipate(); |
193 |
– |
extern void raytexture(); |
194 |
– |
extern int raymixture(); |
195 |
– |
extern double raydist(); |
196 |
– |
extern double raynormal(); |
197 |
– |
extern void newrayxf(); |
198 |
– |
extern void flipsurface(); |
199 |
– |
extern int localhit(); |
200 |
– |
extern int getrenderopt(); |
201 |
– |
extern void print_rdefaults(); |
202 |
– |
extern void drawsources(); |
203 |
– |
extern void rtrace(); |
204 |
– |
extern void rview(); |
205 |
– |
extern void rpict(); |
206 |
– |
|
207 |
– |
#else |
165 |
|
/* defined in duphead.c */ |
166 |
|
extern void headclean(void); |
167 |
|
extern void openheader(void); |
168 |
|
extern void dupheader(void); |
169 |
+ |
/* defined in persist.c */ |
170 |
+ |
extern void persistfile(char *pfn); |
171 |
|
extern void pfdetach(void); |
172 |
|
extern void pfclean(void); |
173 |
|
extern void pflock(int lf); |
195 |
|
extern void ray_popen(int nadd); |
196 |
|
extern void ray_pclose(int nsub); |
197 |
|
/* defined in raytrace.c */ |
198 |
< |
extern int rayorigin(RAY *r, RAY *ro, int rt, double rw); |
198 |
> |
extern int rayorigin(RAY *r, int rt, const RAY *ro, const COLOR rc); |
199 |
|
extern void rayclear(RAY *r); |
200 |
|
extern void raytrace(RAY *r); |
201 |
|
extern void rayhit(OBJECT *oset, RAY *r); |
205 |
|
extern void rayparticipate(RAY *r); |
206 |
|
extern void raytexture(RAY *r, OBJECT mod); |
207 |
|
extern int raymixture(RAY *r, OBJECT fore, OBJECT back, double coef); |
208 |
< |
extern double raydist(RAY *r, int flags); |
208 |
> |
extern void raycontrib(COLOR rc, const RAY *r, int flags); |
209 |
> |
extern double raydist(const RAY *r, int flags); |
210 |
|
extern double raynormal(FVECT norm, RAY *r); |
211 |
|
extern void newrayxf(RAY *r); |
212 |
|
extern void flipsurface(RAY *r); |
217 |
|
/* defined in srcdraw.c */ |
218 |
|
extern void drawsources(COLOR *pic[], float *zbf[], |
219 |
|
int x0, int xsiz, int y0, int ysiz); |
220 |
+ |
extern void init_drawsources(int rad); |
221 |
+ |
/* defined in rt/initotypes.c */ |
222 |
+ |
extern void initotypes(void); |
223 |
|
/* module main procedures */ |
224 |
|
extern void rtrace(char *fname); |
225 |
+ |
extern char * formstr(int f); |
226 |
|
extern void rview(void); |
227 |
|
extern void rpict(int seq, char *pout, char *zout, char *prvr); |
228 |
|
|
229 |
+ |
|
230 |
+ |
#ifdef __cplusplus |
231 |
+ |
} |
232 |
|
#endif |
233 |
+ |
#endif /* _RAD_RAY_H_ */ |
234 |
+ |
|