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.4 by greg, Sat Dec 15 16:41:44 1990 UTC vs.
Revision 2.14 by greg, Tue Mar 4 19:02:22 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 <        OBJREC  *ro;            /* intersected object */
43 <        double  rot;            /* distance to object */
44 <        FVECT  rop;             /* intersection point */
45 <        FVECT  ron;             /* intersection surface normal */
46 <        double  rod;            /* -DOT(rdir, ron) */
47 <        FULLXF  *rox;           /* object transformation */
48 <        FVECT  pert;            /* surface normal perturbation */
49 <        COLOR  pcol;            /* pattern color */
50 <        COLOR  rcol;            /* returned ray value */
51 <        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 >        FVECT   pert;           /* surface normal perturbation */
53 >        COLOR   pcol;           /* pattern color */
54 >        COLOR   rcol;           /* returned ray value */
55 >        double  rt;             /* returned effective ray length */
56 >        COLOR   cext;           /* medium extinction coefficient */
57 >        COLOR   albedo;         /* medium scattering albedo */
58 >        float   gecc;           /* scattering eccentricity coefficient */
59 >        int     *slights;       /* list of lights to test for scattering */
60   }  RAY;
61  
62 < extern double  raynormal();
62 > #define  rayvalue(r)    (*(r)->revf)(r)
63 >
64 > extern char  VersionID[];       /* Radiance version ID string */
65 >
66 > extern CUBE     thescene;       /* our scene */
67 > extern OBJECT   nsceneobjs;     /* number of objects in our scene */
68 >
69 > extern unsigned long    raynum; /* next ray ID */
70 > extern unsigned long    nrays;  /* total rays traced so far */
71 >
72 > extern OBJREC  Lamb;            /* a Lambertian surface */
73 > extern OBJREC  Aftplane;        /* aft clipping object */
74 >
75 > extern void     (*trace)();     /* global trace reporting callback */
76 >
77 > extern int      dimlist[];      /* dimension list for distribution */
78 > extern int      ndims;          /* number of dimensions so far */
79 > extern int      samplendx;      /* index for this sample */
80 >
81 > extern int      ray_savesiz;    /* size of parameter save buffer */
82 >
83 > extern int      do_irrad;       /* compute irradiance? */
84 >
85 > extern double   dstrsrc;        /* square source distribution */
86 > extern double   shadthresh;     /* shadow threshold */
87 > extern double   shadcert;       /* shadow testing certainty */
88 > extern int      directrelay;    /* number of source relays */
89 > extern int      vspretest;      /* virtual source pretest density */
90 > extern int      directvis;      /* light sources visible to eye? */
91 > extern double   srcsizerat;     /* maximum source size/dist. ratio */
92 >
93 > extern double   specthresh;     /* specular sampling threshold */
94 > extern double   specjitter;     /* specular sampling jitter */
95 >
96 > extern COLOR    cextinction;    /* global extinction coefficient */
97 > extern COLOR    salbedo;        /* global scattering albedo */
98 > extern double   seccg;          /* global scattering eccentricity */
99 > extern double   ssampdist;      /* scatter sampling distance */
100 >
101 > extern int      backvis;        /* back face visibility */
102 >
103 > extern int      maxdepth;       /* maximum recursion depth */
104 > extern double   minweight;      /* minimum ray weight */
105 >
106 > extern char     *ambfile;       /* ambient file name */
107 > extern COLOR    ambval;         /* ambient value */
108 > extern int      ambvwt;         /* initial weight for ambient value */
109 > extern double   ambacc;         /* ambient accuracy */
110 > extern int      ambres;         /* ambient resolution */
111 > extern int      ambdiv;         /* ambient divisions */
112 > extern int      ambssamp;       /* ambient super-samples */
113 > extern int      ambounce;       /* ambient bounces */
114 > extern char     *amblist[];     /* ambient include/exclude list */
115 > extern int      ambincl;        /* include == 1, exclude == 0 */
116 >
117 > extern int      ray_pnprocs;    /* number of child processes */
118 > extern int      ray_pnidle;     /* number of idle processes */
119 >
120 > #define AMBLLEN         128     /* max. ambient list length */
121 > #define AMBWORD         8       /* average word length */
122 >
123 > typedef struct {                /* rendering parameter holder */
124 >        int     do_irrad;
125 >        double  dstrsrc;
126 >        double  shadthresh;
127 >        double  shadcert;
128 >        int     directrelay;
129 >        int     vspretest;
130 >        int     directvis;
131 >        double  srcsizerat;
132 >        COLOR   cextinction;
133 >        COLOR   salbedo;
134 >        double  seccg;
135 >        double  ssampdist;
136 >        double  specthresh;
137 >        double  specjitter;
138 >        int     backvis;
139 >        int     maxdepth;
140 >        double  minweight;
141 >        char    ambfile[512];
142 >        COLOR   ambval;
143 >        int     ambvwt;
144 >        double  ambacc;
145 >        int     ambres;
146 >        int     ambdiv;
147 >        int     ambssamp;
148 >        int     ambounce;
149 >        int     ambincl;
150 >        short   amblndx[AMBLLEN+1];
151 >        char    amblval[AMBLLEN*AMBWORD];
152 > } RAYPARAMS;
153 >
154 > #define rpambmod(p,i)   ( (i)>=AMBLLEN||(p)->amblndx[i]<0 ? \
155 >                          (char *)NULL : (p)->amblval+(p)->amblndx[i] )
156 >
157 > #ifdef NOPROTO
158 >
159 > extern void     headclean();
160 > extern void     openheader();
161 > extern void     dupheader();
162 > extern void     pfdetach();
163 > extern void     pfclean();
164 > extern void     pflock();
165 > extern void     pfhold();
166 > extern void     io_process();
167 > extern int      free_objs();
168 > extern void     free_objmem();
169 > extern int      load_os();
170 > extern void     preload_objs();
171 > extern void     ray_init();
172 > extern void     ray_trace();
173 > extern void     ray_done();
174 > extern void     ray_save();
175 > extern void     ray_restore();
176 > extern void     ray_defaults();
177 > extern void     ray_pinit();
178 > extern void     ray_psend();
179 > extern int      ray_pqueue();
180 > extern int      ray_presult();
181 > extern void     ray_pdone();
182 > extern void     ray_popen();
183 > extern void     ray_pclose();
184 > extern int      rayorigin();
185 > extern void     rayclear();
186 > extern void     raytrace();
187 > extern void     rayhit();
188 > extern void     raycont();
189 > extern void     raytrans();
190 > extern int      rayshade();
191 > extern void     rayparticipate();
192 > extern int      raymixture();
193 > extern double   raydist();
194 > extern double   raynormal();
195 > extern void     newrayxf();
196 > extern void     flipsurface();
197 > extern int      localhit();
198 > extern int      getrenderopt();
199 > extern void     print_rdefaults();
200 > extern void     drawsources();
201 > extern void     rtrace();
202 > extern void     rview();
203 > extern void     rpict();
204 >
205 > #else
206 >                                        /* defined in duphead.c */
207 > extern void     headclean(void);
208 > extern void     openheader(void);
209 > extern void     dupheader(void);
210 > extern void     pfdetach(void);
211 > extern void     pfclean(void);
212 > extern void     pflock(int lf);
213 > extern void     pfhold(void);
214 > extern void     io_process(void);
215 >                                        /* defined in freeobjmem.c */
216 > extern int      free_objs(OBJECT on, OBJECT no);
217 > extern void     free_objmem(void);
218 >                                        /* defined in preload.c */
219 > extern int      load_os(OBJREC *op);
220 > extern void     preload_objs(void);
221 >                                        /* defined in raycalls.c */
222 > extern void     ray_init(char *otnm);
223 > extern void     ray_trace(RAY *r);
224 > extern void     ray_done(int freall);
225 > extern void     ray_save(RAYPARAMS *rp);
226 > extern void     ray_restore(RAYPARAMS *rp);
227 > extern void     ray_defaults(RAYPARAMS *rp);
228 >                                        /* defined in raypcalls.c */
229 > extern void     ray_pinit(char *otnm, int nproc);
230 > extern void     ray_psend(RAY *r);
231 > extern int      ray_pqueue(RAY *r);
232 > extern int      ray_presult(RAY *r, int poll);
233 > extern void     ray_pdone(int freall);
234 > extern void     ray_popen(int nadd);
235 > extern void     ray_pclose(int nsub);
236 >                                        /* defined in raytrace.c */
237 > extern int      rayorigin(RAY *r, RAY *ro, int rt, double rw);
238 > extern void     rayclear(RAY *r);
239 > extern void     raytrace(RAY *r);
240 > extern void     rayhit(OBJECT *oset, RAY *r);
241 > extern void     raycont(RAY *r);
242 > extern void     raytrans(RAY *r);
243 > extern int      rayshade(RAY *r, int mod);
244 > extern void     rayparticipate(RAY *r);
245 > extern int      raymixture(RAY *r, OBJECT fore, OBJECT back, double coef);
246 > extern double   raydist(RAY *r, int flags);
247 > extern double   raynormal(FVECT norm, RAY *r);
248 > extern void     newrayxf(RAY *r);
249 > extern void     flipsurface(RAY *r);
250 > extern int      localhit(RAY *r, CUBE *scene);
251 >                                        /* defined in renderopts.c */
252 > extern int      getrenderopt(int ac, char *av[]);
253 > extern void     print_rdefaults(void);
254 >                                        /* defined in srcdraw.c */
255 > extern void     drawsources(COLOR *pic[], float *zbf[],
256 >                        int x0, int xsiz, int y0, int ysiz);
257 >                                        /* module main procedures */
258 > extern void     rtrace(char *fname);
259 > extern void     rview(void);
260 > extern void     rpict(int seq, char *pout, char *zout, char *prvr);
261 >
262 > #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines