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 2.15 by greg, Tue Mar 11 17:08:55 2003 UTC vs.
Revision 2.33 by greg, Tue Dec 15 18:21:53 2009 UTC

# Line 2 | Line 2
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 + #ifndef RNUMBER
18 + #define RNUMBER         unsigned long   /* ray counter (>= sizeof pointer) */
19 + #endif
20 +
21   #define  MAXDIM         32      /* maximum number of dimensions */
22  
23                                  /* ray type flags */
# Line 27 | Line 32
32                                  /* reflected ray types */
33   #define  RAYREFL        (SHADOW|REFLECTED|AMBIENT|SPECULAR)
34  
35 + /* Arrange so double's come first for optimal alignment */
36 + /* Pointers and long's come second for 64-bit mode */
37 + /* Int's next (unknown length), then floats, followed by short's & char's */
38   typedef struct ray {
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 */
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 */
41 >        RREAL   rmax;           /* maximum distance (aft clipping plane) */
42 >        RREAL   rot;            /* distance to object */
43 >        FVECT   rop;            /* intersection point */
44 >        FVECT   ron;            /* intersection surface normal */
45 >        RREAL   rod;            /* -DOT(rdir, ron) */
46 >        RREAL   uv[2];          /* local coordinates */
47 >        FVECT   pert;           /* surface normal perturbation */
48 >        RREAL   rt;             /* returned effective ray length */
49 >        const struct ray  *parent;      /* ray this originated from */
50          OBJECT  *clipset;       /* set of objects currently clipped */
51          OBJECT  *newcset;       /* next clipset, used for transmission */
52 <        void    (*revf)();      /* evaluation function for this ray */
53 <        void    (*hitf)();      /* custom hit test for this traversal */
45 <        OBJECT  robj;           /* intersected object number */
52 >        void    (*revf)(struct ray *);  /* ray evaluation function */
53 >        void    (*hitf)(OBJECT *, struct ray *);        /* custom hit test */
54          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) */
55          FULLXF  *rox;           /* object transformation */
56 <        FLOAT   uv[2];          /* local coordinates */
57 <        FVECT   pert;           /* surface normal perturbation */
56 >        int     *slights;       /* list of lights to test for scattering */
57 >        RNUMBER rno;            /* unique ray number */
58 >        int     rlvl;           /* number of reflections for this ray */
59 >        int     rsrc;           /* source we're aiming for */
60 >        float   rweight;        /* cumulative weight (for termination) */
61 >        COLOR   rcoef;          /* contribution coefficient w.r.t. parent */
62          COLOR   pcol;           /* pattern color */
63 <        COLOR   rcol;           /* returned ray value */
56 <        double  rt;             /* returned effective ray length */
63 >        COLOR   rcol;           /* returned radiance value */
64          COLOR   cext;           /* medium extinction coefficient */
65          COLOR   albedo;         /* medium scattering albedo */
66          float   gecc;           /* scattering eccentricity coefficient */
67 <        int     *slights;       /* list of lights to test for scattering */
67 >        OBJECT  robj;           /* intersected object number */
68 >        short   rtype;          /* ray type */
69 >        short   crtype;         /* cumulative ray type */
70   }  RAY;
71  
72   #define  rayvalue(r)    (*(r)->revf)(r)
# Line 83 | Line 92 | extern int     ray_savesiz;    /* size of parameter save buff
92  
93   extern int      do_irrad;       /* compute irradiance? */
94  
95 + extern int      rand_samp;      /* pure Monte Carlo sampling? */
96 +
97   extern double   dstrsrc;        /* square source distribution */
98   extern double   shadthresh;     /* shadow threshold */
99   extern double   shadcert;       /* shadow testing certainty */
# Line 118 | Line 129 | extern int     ambincl;        /* include == 1, exclude == 0 */
129   extern int      ray_pnprocs;    /* number of child processes */
130   extern int      ray_pnidle;     /* number of idle processes */
131  
132 < #define AMBLLEN         128     /* max. ambient list length */
133 < #define AMBWORD         8       /* average word length */
132 > #ifndef AMBLLEN
133 > #define AMBLLEN         512     /* max. ambient list length */
134 > #endif
135 > #define AMBWORD         12      /* average word length */
136  
137   typedef struct {                /* rendering parameter holder */
138          int     do_irrad;
139 +        int     rand_samp;
140          double  dstrsrc;
141          double  shadthresh;
142          double  shadcert;
# Line 155 | Line 169 | typedef struct {               /* rendering parameter holder */
169   #define rpambmod(p,i)   ( (i)>=AMBLLEN||(p)->amblndx[i]<0 ? \
170                            (char *)NULL : (p)->amblval+(p)->amblndx[i] )
171  
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 int      raymixture();
194 extern double   raydist();
195 extern double   raynormal();
196 extern void     newrayxf();
197 extern void     flipsurface();
198 extern int      localhit();
199 extern int      getrenderopt();
200 extern void     print_rdefaults();
201 extern void     drawsources();
202 extern void     rtrace();
203 extern void     rview();
204 extern void     rpict();
205
206 #else
172                                          /* defined in duphead.c */
173   extern void     headclean(void);
174   extern void     openheader(void);
175   extern void     dupheader(void);
176 +                                        /* defined in persist.c */
177 + extern void persistfile(char *pfn);
178   extern void     pfdetach(void);
179   extern void     pfclean(void);
180   extern void     pflock(int lf);
# Line 228 | Line 195 | extern void    ray_restore(RAYPARAMS *rp);
195   extern void     ray_defaults(RAYPARAMS *rp);
196                                          /* defined in raypcalls.c */
197   extern void     ray_pinit(char *otnm, int nproc);
198 < extern void     ray_psend(RAY *r);
198 > extern int      ray_psend(RAY *r);
199   extern int      ray_pqueue(RAY *r);
200   extern int      ray_presult(RAY *r, int poll);
201   extern void     ray_pdone(int freall);
202   extern void     ray_popen(int nadd);
203   extern void     ray_pclose(int nsub);
204 +                                        /* defined in ray_fifo.c */
205 + extern int      (*ray_fifo_out)(RAY *r);
206 + extern int      ray_fifo_in(RAY *r);
207 + extern int      ray_fifo_flush(void);
208                                          /* defined in raytrace.c */
209 < extern int      rayorigin(RAY *r, RAY *ro, int rt, double rw);
209 > extern int      rayorigin(RAY *r, int rt, const RAY *ro, const COLOR rc);
210   extern void     rayclear(RAY *r);
211   extern void     raytrace(RAY *r);
212   extern void     rayhit(OBJECT *oset, RAY *r);
# Line 243 | Line 214 | extern void    raycont(RAY *r);
214   extern void     raytrans(RAY *r);
215   extern int      rayshade(RAY *r, int mod);
216   extern void     rayparticipate(RAY *r);
217 + extern void     raytexture(RAY *r, OBJECT mod);
218   extern int      raymixture(RAY *r, OBJECT fore, OBJECT back, double coef);
219 < extern double   raydist(RAY *r, int flags);
219 > extern void     raycontrib(double rc[3], const RAY *r, int flags);
220 > extern double   raydist(const RAY *r, int flags);
221   extern double   raynormal(FVECT norm, RAY *r);
222   extern void     newrayxf(RAY *r);
223   extern void     flipsurface(RAY *r);
# Line 255 | Line 228 | extern void    print_rdefaults(void);
228                                          /* defined in srcdraw.c */
229   extern void     drawsources(COLOR *pic[], float *zbf[],
230                          int x0, int xsiz, int y0, int ysiz);
231 + extern void init_drawsources(int rad);
232 +                                        /* defined in rt/initotypes.c */
233 + extern void initotypes(void);
234                                          /* module main procedures */
235 < extern void     rtrace(char *fname);
235 > extern void     rtrace(char *fname, int nproc);
236 > extern char     *formstr(int  f);
237   extern void     rview(void);
238   extern void     rpict(int seq, char *pout, char *zout, char *prvr);
239  
240 +
241 + #ifdef __cplusplus
242 + }
243   #endif
244 + #endif /* _RAD_RAY_H_ */
245 +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines