--- ray/src/rt/ray.h 1990/03/22 20:07:01 1.3 +++ ray/src/rt/ray.h 1995/12/09 09:35:00 2.6 @@ -1,4 +1,4 @@ -/* Copyright (c) 1986 Regents of the University of California */ +/* Copyright (c) 1995 Regents of the University of California */ /* SCCSid "$SunId$ LBL" */ @@ -14,6 +14,10 @@ #include "color.h" +#define MAXDIM 32 /* maximum number of dimensions */ + +#define MAXSLIST 32 /* maximum sources to check */ + /* ray type flags */ #define PRIMARY 01 /* original ray */ #define SHADOW 02 /* ray to light source */ @@ -21,12 +25,13 @@ #define REFRACTED 010 /* refracted (bent) ray */ #define TRANS 020 /* transmitted/transferred ray */ #define AMBIENT 040 /* ray scattered for interreflection */ +#define SPECULAR 0100 /* ray scattered for specular */ /* reflected ray types */ -#define RAYREFL (SHADOW|REFLECTED|AMBIENT) +#define RAYREFL (SHADOW|REFLECTED|AMBIENT|SPECULAR) typedef struct ray { - long rno; /* unique ray number */ + unsigned long rno; /* unique ray number */ int rlvl; /* number of reflections for this ray */ float rweight; /* cumulative weight of this ray */ short rtype; /* ray type */ @@ -34,22 +39,35 @@ typedef struct ray { struct ray *parent; /* ray this originated from */ FVECT rorg; /* origin of ray */ FVECT rdir; /* normalized direction of ray */ + double rmax; /* maximum distance (aft clipping plane) */ int rsrc; /* source we're aiming for */ OBJECT *clipset; /* set of objects currently clipped */ OBJECT *newcset; /* next clipset, used for transmission */ + int (*revf)(); /* evaluation function for this ray */ OBJREC *ro; /* intersected object */ double rot; /* distance to object */ FVECT rop; /* intersection point */ FVECT ron; /* intersection surface normal */ double rod; /* -DOT(rdir, ron) */ - double rofx[4][4]; /* transform from object space */ - double rofs; /* scaling factor from object */ - double robx[4][4]; /* transform back to object space */ - double robs; /* back scaling factor */ + FULLXF *rox; /* object transformation */ FVECT pert; /* surface normal perturbation */ COLOR pcol; /* pattern color */ COLOR rcol; /* returned ray value */ double rt; /* returned effective ray length */ + COLOR cext; /* medium extinction coefficient */ + float albedo; /* medium scattering albedo */ + float gecc; /* scattering eccentricity coefficient */ + int *slights; /* list of lights to test for scattering */ } RAY; +extern int raytrace(); + extern double raynormal(); + +extern double raydistance(); + +extern int dimlist[]; /* dimension list for distribution */ +extern int ndims; /* number of dimensions so far */ +extern int samplendx; /* index for this sample */ + +#define rayvalue(r) (*(r)->revf)(r)