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)(struct ray *); /* evaluation function for this ray */ |
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) */ |
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 */ |
129 |
|
|
130 |
|
typedef struct { /* rendering parameter holder */ |
131 |
|
int do_irrad; |
132 |
+ |
int rand_samp; |
133 |
|
double dstrsrc; |
134 |
|
double shadthresh; |
135 |
|
double shadcert; |
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); |