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.2 by greg, Tue Apr 11 13:16:43 1989 UTC vs.
Revision 2.27 by greg, Mon Jun 13 20:07:56 2005 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1986 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 + #ifndef _RAD_RAY_H_
6 + #define _RAD_RAY_H_
7  
8   #include  "standard.h"
9 <
9 > #include  "octree.h"
10   #include  "object.h"
14
11   #include  "color.h"
12  
13 + #ifdef __cplusplus
14 + extern "C" {
15 + #endif
16 +
17 + #define  MAXDIM         32      /* maximum number of dimensions */
18 +
19                                  /* ray type flags */
20   #define  PRIMARY        01              /* original ray */
21   #define  SHADOW         02              /* ray to light source */
# Line 21 | Line 23
23   #define  REFRACTED      010             /* refracted (bent) ray */
24   #define  TRANS          020             /* transmitted/transferred ray */
25   #define  AMBIENT        040             /* ray scattered for interreflection */
26 + #define  SPECULAR       0100            /* ray scattered for specular */
27  
28                                  /* reflected ray types */
29 < #define  RAYREFL        (SHADOW|REFLECTED|AMBIENT)
29 > #define  RAYREFL        (SHADOW|REFLECTED|AMBIENT|SPECULAR)
30  
31   typedef struct ray {
32 <        long  rno;              /* unique ray number */
33 <        int  rlvl;              /* number of reflections for this ray */
34 <        float  rweight;         /* cumulative weight of this ray */
35 <        short  rtype;           /* ray type */
36 <        short  crtype;          /* cumulative ray type */
37 <        struct ray  *parent;    /* ray this originated from */
38 <        FVECT  rorg;            /* origin of ray */
39 <        FVECT  rdir;            /* normalized direction of ray */
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 <        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 <        double  rofx[4][4];     /* transform from object space */
49 <        double  rofs;           /* scaling factor from object */
50 <        double  robx[4][4];     /* transform back to object space */
51 <        double  robs;           /* back scaling factor */
52 <        FVECT  pert;            /* surface normal perturbation */
53 <        COLOR  pcol;            /* pattern color */
54 <        COLOR  rcol;            /* returned ray value */
32 >        unsigned long  rno;     /* unique ray number */
33 >        int     rlvl;           /* number of reflections for 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 >        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 *);  /* 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) */
49 >        double  rot;            /* distance to object */
50 >        FVECT   rop;            /* intersection point */
51 >        FVECT   ron;            /* intersection surface normal */
52 >        double  rod;            /* -DOT(rdir, ron) */
53 >        FULLXF  *rox;           /* object transformation */
54 >        RREAL   uv[2];          /* local coordinates */
55 >        FVECT   pert;           /* surface normal perturbation */
56 >        COLOR   pcol;           /* pattern color */
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 */
61 >        float   gecc;           /* scattering eccentricity coefficient */
62 >        int     *slights;       /* list of lights to test for scattering */
63   }  RAY;
64  
65 < extern double  raynormal();
65 > #define  rayvalue(r)    (*(r)->revf)(r)
66 >
67 > extern char  VersionID[];       /* Radiance version ID string */
68 >
69 > extern CUBE     thescene;       /* our scene */
70 > extern OBJECT   nsceneobjs;     /* number of objects in our scene */
71 >
72 > extern unsigned long    raynum; /* next ray ID */
73 > extern unsigned long    nrays;  /* total rays traced so far */
74 >
75 > extern OBJREC  Lamb;            /* a Lambertian surface */
76 > extern OBJREC  Aftplane;        /* aft clipping object */
77 >
78 > extern void     (*trace)();     /* global trace reporting callback */
79 >
80 > extern int      dimlist[];      /* dimension list for distribution */
81 > extern int      ndims;          /* number of dimensions so far */
82 > extern int      samplendx;      /* index for this sample */
83 >
84 > extern int      ray_savesiz;    /* size of parameter save buffer */
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 */
93 > extern int      directrelay;    /* number of source relays */
94 > extern int      vspretest;      /* virtual source pretest density */
95 > extern int      directvis;      /* light sources visible to eye? */
96 > extern double   srcsizerat;     /* maximum source size/dist. ratio */
97 >
98 > extern double   specthresh;     /* specular sampling threshold */
99 > extern double   specjitter;     /* specular sampling jitter */
100 >
101 > extern COLOR    cextinction;    /* global extinction coefficient */
102 > extern COLOR    salbedo;        /* global scattering albedo */
103 > extern double   seccg;          /* global scattering eccentricity */
104 > extern double   ssampdist;      /* scatter sampling distance */
105 >
106 > extern int      backvis;        /* back face visibility */
107 >
108 > extern int      maxdepth;       /* maximum recursion depth */
109 > extern double   minweight;      /* minimum ray weight */
110 >
111 > extern char     *ambfile;       /* ambient file name */
112 > extern COLOR    ambval;         /* ambient value */
113 > extern int      ambvwt;         /* initial weight for ambient value */
114 > extern double   ambacc;         /* ambient accuracy */
115 > extern int      ambres;         /* ambient resolution */
116 > extern int      ambdiv;         /* ambient divisions */
117 > extern int      ambssamp;       /* ambient super-samples */
118 > extern int      ambounce;       /* ambient bounces */
119 > extern char     *amblist[];     /* ambient include/exclude list */
120 > extern int      ambincl;        /* include == 1, exclude == 0 */
121 >
122 > extern int      ray_pnprocs;    /* number of child processes */
123 > extern int      ray_pnidle;     /* number of idle processes */
124 >
125 > #ifndef AMBLLEN
126 > #define AMBLLEN         512     /* max. ambient list length */
127 > #endif
128 > #define AMBWORD         12      /* average word length */
129 >
130 > typedef struct {                /* rendering parameter holder */
131 >        int     do_irrad;
132 >        int     rand_samp;
133 >        double  dstrsrc;
134 >        double  shadthresh;
135 >        double  shadcert;
136 >        int     directrelay;
137 >        int     vspretest;
138 >        int     directvis;
139 >        double  srcsizerat;
140 >        COLOR   cextinction;
141 >        COLOR   salbedo;
142 >        double  seccg;
143 >        double  ssampdist;
144 >        double  specthresh;
145 >        double  specjitter;
146 >        int     backvis;
147 >        int     maxdepth;
148 >        double  minweight;
149 >        char    ambfile[512];
150 >        COLOR   ambval;
151 >        int     ambvwt;
152 >        double  ambacc;
153 >        int     ambres;
154 >        int     ambdiv;
155 >        int     ambssamp;
156 >        int     ambounce;
157 >        int     ambincl;
158 >        short   amblndx[AMBLLEN+1];
159 >        char    amblval[AMBLLEN*AMBWORD];
160 > } RAYPARAMS;
161 >
162 > #define rpambmod(p,i)   ( (i)>=AMBLLEN||(p)->amblndx[i]<0 ? \
163 >                          (char *)NULL : (p)->amblval+(p)->amblndx[i] )
164 >
165 >                                        /* defined in duphead.c */
166 > extern void     headclean(void);
167 > extern void     openheader(void);
168 > extern void     dupheader(void);
169 >                                        /* defined in persist.c */
170 > extern void persistfile(char *pfn);
171 > extern void     pfdetach(void);
172 > extern void     pfclean(void);
173 > extern void     pflock(int lf);
174 > extern void     pfhold(void);
175 > extern void     io_process(void);
176 >                                        /* defined in freeobjmem.c */
177 > extern int      free_objs(OBJECT on, OBJECT no);
178 > extern void     free_objmem(void);
179 >                                        /* defined in preload.c */
180 > extern int      load_os(OBJREC *op);
181 > extern void     preload_objs(void);
182 >                                        /* defined in raycalls.c */
183 > extern void     ray_init(char *otnm);
184 > extern void     ray_trace(RAY *r);
185 > extern void     ray_done(int freall);
186 > extern void     ray_save(RAYPARAMS *rp);
187 > extern void     ray_restore(RAYPARAMS *rp);
188 > extern void     ray_defaults(RAYPARAMS *rp);
189 >                                        /* defined in raypcalls.c */
190 > extern void     ray_pinit(char *otnm, int nproc);
191 > extern void     ray_psend(RAY *r);
192 > extern int      ray_pqueue(RAY *r);
193 > extern int      ray_presult(RAY *r, int poll);
194 > extern void     ray_pdone(int freall);
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, 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);
202 > extern void     raycont(RAY *r);
203 > extern void     raytrans(RAY *r);
204 > extern int      rayshade(RAY *r, int mod);
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 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);
213 > extern int      localhit(RAY *r, CUBE *scene);
214 >                                        /* defined in renderopts.c */
215 > extern int      getrenderopt(int ac, char *av[]);
216 > extern void     print_rdefaults(void);
217 >                                        /* defined in srcdraw.c */
218 > extern void     drawsources(COLOR *pic[], float *zbf[],
219 >                        int x0, int xsiz, int y0, int ysiz);
220 > extern void init_drawsources(int rad);
221 >                                        /* defined in rt/initotypes.c */
222 > extern void initotypes(void);
223 >                                        /* module main procedures */
224 > extern void     rtrace(char *fname);
225 > extern char * formstr(int  f);
226 > extern void     rview(void);
227 > extern void     rpict(int seq, char *pout, char *zout, char *prvr);
228 >
229 >
230 > #ifdef __cplusplus
231 > }
232 > #endif
233 > #endif /* _RAD_RAY_H_ */
234 >

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines