ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/ray.h
(Generate patch)

Comparing ray/src/rt/ray.h (file contents):
Revision 1.6 by greg, Thu Jun 20 13:29:31 1991 UTC vs.
Revision 2.16 by greg, Fri May 9 22:18:03 2003 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1990 Regents of the University of California */
2 <
3 < /* SCCSid "$SunId$ LBL" */
4 <
1 > /* RCSid $Id$ */
2   /*
3   *  ray.h - header file for routines using rays.
7 *
8 *     8/7/85
4   */
5  
6 + #include "copyright.h"
7 +
8   #include  "standard.h"
9  
10 + #include  "octree.h"
11 +
12   #include  "object.h"
13  
14   #include  "color.h"
15  
16 + #define  MAXDIM         32      /* maximum number of dimensions */
17 +
18                                  /* ray type flags */
19   #define  PRIMARY        01              /* original ray */
20   #define  SHADOW         02              /* ray to light source */
# Line 21 | Line 22
22   #define  REFRACTED      010             /* refracted (bent) ray */
23   #define  TRANS          020             /* transmitted/transferred ray */
24   #define  AMBIENT        040             /* ray scattered for interreflection */
25 + #define  SPECULAR       0100            /* ray scattered for specular */
26  
27                                  /* reflected ray types */
28 < #define  RAYREFL        (SHADOW|REFLECTED|AMBIENT)
28 > #define  RAYREFL        (SHADOW|REFLECTED|AMBIENT|SPECULAR)
29  
30   typedef struct ray {
31 <        long  rno;              /* unique ray number */
32 <        int  rlvl;              /* number of reflections for this ray */
33 <        float  rweight;         /* cumulative weight of this ray */
34 <        short  rtype;           /* ray type */
35 <        short  crtype;          /* cumulative ray type */
31 >        unsigned long  rno;     /* unique ray number */
32 >        int     rlvl;           /* number of reflections for this ray */
33 >        float   rweight;        /* cumulative weight of this ray */
34 >        short   rtype;          /* ray type */
35 >        short   crtype;         /* cumulative ray type */
36          struct ray  *parent;    /* ray this originated from */
37 <        FVECT  rorg;            /* origin of ray */
38 <        FVECT  rdir;            /* normalized direction of ray */
39 <        int  rsrc;              /* source we're aiming for */
40 <        OBJECT  *clipset;       /* set of objects currently clipped */
41 <        OBJECT  *newcset;       /* next clipset, used for transmission */
42 <        int  (*revf)();         /* evaluation function for this ray */
43 <        OBJREC  *ro;            /* intersected object */
44 <        double  rot;            /* distance to object */
45 <        FVECT  rop;             /* intersection point */
46 <        FVECT  ron;             /* intersection surface normal */
47 <        double  rod;            /* -DOT(rdir, ron) */
48 <        FULLXF  *rox;           /* object transformation */
49 <        FVECT  pert;            /* surface normal perturbation */
50 <        COLOR  pcol;            /* pattern color */
51 <        COLOR  rcol;            /* returned ray value */
52 <        double  rt;             /* returned effective ray length */
37 >        FVECT   rorg;           /* origin of ray */
38 >        FVECT   rdir;           /* normalized direction of ray */
39 >        double  rmax;           /* maximum distance (aft clipping plane) */
40 >        int     rsrc;           /* source we're aiming for */
41 >        OBJECT  *clipset;       /* set of objects currently clipped */
42 >        OBJECT  *newcset;       /* next clipset, used for transmission */
43 >        void    (*revf)();      /* evaluation function for this ray */
44 >        void    (*hitf)();      /* custom hit test for this traversal */
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 >        FLOAT   uv[2];          /* local coordinates */
53 >        FVECT   pert;           /* surface normal perturbation */
54 >        COLOR   pcol;           /* pattern color */
55 >        COLOR   rcol;           /* returned ray 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 int  raytrace();
63 > #define  rayvalue(r)    (*(r)->revf)(r)
64  
65 < extern double  raynormal();
65 > extern char  VersionID[];       /* Radiance version ID string */
66  
67 < extern int  dimlist[];          /* dimension list for distribution */
68 < extern int  ndims;              /* number of dimensions so far */
59 < extern int  samplendx;          /* index for this sample */
67 > extern CUBE     thescene;       /* our scene */
68 > extern OBJECT   nsceneobjs;     /* number of objects in our scene */
69  
70 < #define  MAXDIM         16      /* maximum number of dimensions */
70 > extern unsigned long    raynum; /* next ray ID */
71 > extern unsigned long    nrays;  /* total rays traced so far */
72  
73 < #define  rayvalue(r)    (*(r)->revf)(r)
73 > extern OBJREC  Lamb;            /* a Lambertian surface */
74 > extern OBJREC  Aftplane;        /* aft clipping object */
75 >
76 > extern void     (*trace)();     /* global trace reporting callback */
77 >
78 > extern int      dimlist[];      /* dimension list for distribution */
79 > extern int      ndims;          /* number of dimensions so far */
80 > extern int      samplendx;      /* index for this sample */
81 >
82 > extern int      ray_savesiz;    /* size of parameter save buffer */
83 >
84 > extern int      do_irrad;       /* compute irradiance? */
85 >
86 > extern double   dstrsrc;        /* square source distribution */
87 > extern double   shadthresh;     /* shadow threshold */
88 > extern double   shadcert;       /* shadow testing certainty */
89 > extern int      directrelay;    /* number of source relays */
90 > extern int      vspretest;      /* virtual source pretest density */
91 > extern int      directvis;      /* light sources visible to eye? */
92 > extern double   srcsizerat;     /* maximum source size/dist. ratio */
93 >
94 > extern double   specthresh;     /* specular sampling threshold */
95 > extern double   specjitter;     /* specular sampling jitter */
96 >
97 > extern COLOR    cextinction;    /* global extinction coefficient */
98 > extern COLOR    salbedo;        /* global scattering albedo */
99 > extern double   seccg;          /* global scattering eccentricity */
100 > extern double   ssampdist;      /* scatter sampling distance */
101 >
102 > extern int      backvis;        /* back face visibility */
103 >
104 > extern int      maxdepth;       /* maximum recursion depth */
105 > extern double   minweight;      /* minimum ray weight */
106 >
107 > extern char     *ambfile;       /* ambient file name */
108 > extern COLOR    ambval;         /* ambient value */
109 > extern int      ambvwt;         /* initial weight for ambient value */
110 > extern double   ambacc;         /* ambient accuracy */
111 > extern int      ambres;         /* ambient resolution */
112 > extern int      ambdiv;         /* ambient divisions */
113 > extern int      ambssamp;       /* ambient super-samples */
114 > extern int      ambounce;       /* ambient bounces */
115 > extern char     *amblist[];     /* ambient include/exclude list */
116 > extern int      ambincl;        /* include == 1, exclude == 0 */
117 >
118 > extern int      ray_pnprocs;    /* number of child processes */
119 > extern int      ray_pnidle;     /* number of idle processes */
120 >
121 > #define AMBLLEN         128     /* max. ambient list length */
122 > #define AMBWORD         8       /* 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 > #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
208 >                                        /* defined in duphead.c */
209 > extern void     headclean(void);
210 > extern void     openheader(void);
211 > extern void     dupheader(void);
212 > extern void     pfdetach(void);
213 > extern void     pfclean(void);
214 > extern void     pflock(int lf);
215 > extern void     pfhold(void);
216 > extern void     io_process(void);
217 >                                        /* defined in freeobjmem.c */
218 > extern int      free_objs(OBJECT on, OBJECT no);
219 > extern void     free_objmem(void);
220 >                                        /* defined in preload.c */
221 > extern int      load_os(OBJREC *op);
222 > extern void     preload_objs(void);
223 >                                        /* defined in raycalls.c */
224 > extern void     ray_init(char *otnm);
225 > extern void     ray_trace(RAY *r);
226 > extern void     ray_done(int freall);
227 > extern void     ray_save(RAYPARAMS *rp);
228 > extern void     ray_restore(RAYPARAMS *rp);
229 > extern void     ray_defaults(RAYPARAMS *rp);
230 >                                        /* defined in raypcalls.c */
231 > extern void     ray_pinit(char *otnm, int nproc);
232 > extern void     ray_psend(RAY *r);
233 > extern int      ray_pqueue(RAY *r);
234 > extern int      ray_presult(RAY *r, int poll);
235 > extern void     ray_pdone(int freall);
236 > extern void     ray_popen(int nadd);
237 > extern void     ray_pclose(int nsub);
238 >                                        /* defined in raytrace.c */
239 > extern int      rayorigin(RAY *r, RAY *ro, int rt, double rw);
240 > extern void     rayclear(RAY *r);
241 > extern void     raytrace(RAY *r);
242 > extern void     rayhit(OBJECT *oset, RAY *r);
243 > extern void     raycont(RAY *r);
244 > extern void     raytrans(RAY *r);
245 > extern int      rayshade(RAY *r, int mod);
246 > extern void     rayparticipate(RAY *r);
247 > extern void     raytexture(RAY *r, OBJECT mod);
248 > extern int      raymixture(RAY *r, OBJECT fore, OBJECT back, double coef);
249 > extern double   raydist(RAY *r, int flags);
250 > extern double   raynormal(FVECT norm, RAY *r);
251 > extern void     newrayxf(RAY *r);
252 > extern void     flipsurface(RAY *r);
253 > extern int      localhit(RAY *r, CUBE *scene);
254 >                                        /* defined in renderopts.c */
255 > extern int      getrenderopt(int ac, char *av[]);
256 > extern void     print_rdefaults(void);
257 >                                        /* defined in srcdraw.c */
258 > extern void     drawsources(COLOR *pic[], float *zbf[],
259 >                        int x0, int xsiz, int y0, int ysiz);
260 >                                        /* module main procedures */
261 > extern void     rtrace(char *fname);
262 > extern void     rview(void);
263 > extern void     rpict(int seq, char *pout, char *zout, char *prvr);
264 >
265 > #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines