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

Comparing ray/src/rt/source.h (file contents):
Revision 2.4 by greg, Tue Nov 7 12:40:36 1995 UTC vs.
Revision 2.13 by schorsch, Tue Mar 30 16:13:01 2004 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1995 Regents of the University of California */
2 <
3 < /* SCCSid "$SunId$ LBL" */
4 <
1 > /* RCSid $Id$ */
2   /*
3   *  source.h - header file for ray tracing sources.
4   *
5 < *     8/20/85
5 > *  Include after ray.h
6   */
7 + #ifndef _RAD_SOURCE_H_
8 + #define _RAD_SOURCE_H_
9  
10 + #include <string.h>
11 +
12 + #ifdef __cplusplus
13 + extern "C" {
14 + #endif
15 +
16 + #ifndef  AIMREQT
17   #define  AIMREQT        100             /* required aim success/failure */
18 + #endif
19 + #ifndef  SHADCACHE
20 + #define  SHADCACHE      20              /* shadow cache resolution */
21 + #endif
22  
23   #define  SDISTANT       01              /* source distant flag */
24   #define  SSKIP          02              /* source skip flag */
# Line 26 | Line 36 | typedef struct {
36   } SPOT;                 /* spotlight */
37  
38   typedef struct {
39 +        union {
40 +                struct {
41 +                        FVECT   u, v;           /* unit vectors */
42 +                }  f;                   /* flat source indexing */
43 +                struct {
44 +                        FVECT   o;              /* origin position */
45 +                        RREAL   e1, e2;         /* 1/extent */
46 +                        int     ax;             /* major direction */
47 +                }  d;                   /* distant source indexing */
48 +        }  p;                   /* indexing parameters */
49 +        OBJECT  obs[1];         /* cache obstructors (extends struct) */
50 + }  OBSCACHE;            /* obstructor cache */
51 +
52 + typedef struct {
53          int  sflags;            /* source flags */
54          FVECT  sloc;            /* direction or position of source */
55          FVECT  ss[3];           /* source dimension vectors, U, V, and W */
56          float  srad;            /* maximum source radius */
57          float  ss2;             /* solid angle or projected area */
58 +        OBJREC  *so;            /* source destination object */
59          struct {
60                  float  prox;            /* proximity */
61                  SPOT  *s;               /* spot */
# Line 42 | Line 67 | typedef struct {
67                          int  sn;                /* next source to aim for */
68                  }  sv;                  /* virtual source */
69          } sa;                   /* source aiming information */
70 <        long  ntests, nhits;    /* shadow tests and hits */
71 <        OBJREC  *so;            /* source destination object */
70 >        unsigned long
71 >                ntests, nhits;  /* shadow tests and hits */
72 > #ifdef  SHADCACHE
73 >        OBSCACHE  *obscache;    /* obstructor cache */
74 > #endif
75   }  SRCREC;              /* light source */
76  
77   #define MAXSPART        64              /* maximum partitions per source */
# Line 65 | Line 93 | typedef struct {
93  
94   #define initsrcindex(s) ((s)->sn = (s)->sp = -1, (s)->np = 0)
95  
96 < #define clrpart(pt)     bzero((char *)(pt), MAXSPART/2)
96 > #define clrpart(pt)     memset((char *)(pt), '\0', MAXSPART/2)
97   #define setpart(pt,i,v) ((pt)[(i)>>2] |= (v)<<(((i)&3)<<1))
98   #define spart(pt,pi)    ((pt)[(pi)>>2] >> (((pi)&3)<<1) & 3)
99  
# Line 91 | Line 119 | typedef struct {
119   } VSMATERIAL;           /* virtual source material functions */
120  
121   typedef struct {
122 <        int     (*setsrc)();    /* set light source for object */
123 <        int     (*partit)();    /* partition light source object */
122 >        void    (*setsrc)();    /* set light source for object */
123 >        void    (*partit)();    /* partition light source object */
124          double  (*getpleq)();   /* plane equation for surface */
125          double  (*getdisk)();   /* maximum disk for surface */
126   } SOBJECT;              /* source object functions */
# Line 107 | Line 135 | extern SRCFUNC  sfun[];                        /* source dispatch table */
135   extern SRCREC  *source;                 /* our source list */
136   extern int  nsources;                   /* the number of sources */
137  
110 extern int  srcvalue();                 /* compute source value w/o shadows */
111 extern double  nextssamp();             /* get next source sample location */
112 extern double  scylform();              /* cosine to axis of cylinder */
113
138   #define  sflatform(sn,dir)      -DOT(source[sn].snorm, dir)
139  
140 < extern OBJREC  *vsmaterial();           /* virtual source material */
140 > #define  getplaneq(c,o)         (*sfun[(o)->otype].of->getpleq)(c,o)
141 > #define  getmaxdisk(c,o)        (*sfun[(o)->otype].of->getdisk)(c,o)
142 > #define  setsource(s,o)         (*sfun[(o)->otype].of->setsrc)(s,o)
143  
144 < extern double  intercircle();           /* intersect two circles */
145 < extern double  spotdisk();              /* intersecting disk for spot */
146 < extern double  beamdisk();              /* intersecting disk for beam */
144 >                                        /* defined in source.c */
145 > extern OBJREC   *findmaterial(OBJREC *o);
146 > extern void     marksources(void);
147 > extern void     freesources(void);
148 > extern int      srcray(RAY *sr, RAY *r, SRCINDEX *si);
149 > extern void     srcvalue(RAY *r);
150 > extern int      sourcehit(RAY *r);
151 > typedef void srcdirf_t(COLOR cv, void *np, FVECT ldir, double omega);
152 > extern void     direct(RAY *r, srcdirf_t *f, void *p);
153 > extern void     srcscatter(RAY *r);
154 > extern int      m_light(OBJREC *m, RAY *r);
155 > extern void     srcblocker(RAY *r);
156 > extern int      srcblocked(RAY *r);
157 > extern void     freeobscache(SRCREC *s);
158 >                                        /* defined in srcsamp.c */
159 > extern double   nextssamp(RAY *r, SRCINDEX *si);
160 > extern int      skipparts(int ct[3], int sz[3], int pp[2], unsigned char *pt);
161 > extern void     nopart(SRCINDEX *si, RAY *r);
162 > extern void     cylpart(SRCINDEX *si, RAY *r);
163 > extern void     flatpart(SRCINDEX *si, RAY *r);
164 > extern double   scylform(int sn, FVECT dir);
165 >                                        /* defined in srcsupp.c */
166 > extern void     initstypes(void);
167 > extern int      newsource(void);
168 > extern void     setflatss(SRCREC *src);
169 > extern void     fsetsrc(SRCREC *src, OBJREC *so);
170 > extern void     ssetsrc(SRCREC *src, OBJREC *so);
171 > extern void     sphsetsrc(SRCREC *src, OBJREC *so);
172 > extern void     rsetsrc(SRCREC *src, OBJREC *so);
173 > extern void     cylsetsrc(SRCREC *src, OBJREC *so);
174 > extern SPOT     *makespot(OBJREC *m);
175 > extern int      spotout(RAY *r, SPOT *s);
176 > extern double   fgetmaxdisk(FVECT ocent, OBJREC *op);
177 > extern double   rgetmaxdisk(FVECT ocent, OBJREC *op);
178 > extern double   fgetplaneq(FVECT nvec, OBJREC *op);
179 > extern double   rgetplaneq(FVECT nvec, OBJREC *op);
180 > extern int      commonspot(SPOT *sp1, SPOT *sp2, FVECT org);
181 > extern int      commonbeam(SPOT *sp1, SPOT *sp2, FVECT org);
182 > extern int      checkspot(SPOT *sp, FVECT nrm);
183 > extern double   spotdisk(FVECT oc, OBJREC *op, SPOT *sp, FVECT pos);
184 > extern double   beamdisk(FVECT oc, OBJREC *op, SPOT *sp, FVECT dir);
185 > extern double   intercircle(FVECT cc, FVECT c1, FVECT c2,
186 >                        double r1s, double r2s);
187 >                                        /* defined in virtuals.c */
188 > extern void     markvirtuals(void);
189 > extern void     addvirtuals(int sn, int nr);
190 > extern void     vproject(OBJREC *o, int sn, int n);
191 > extern OBJREC   *vsmaterial(OBJREC *o);
192 > extern int      makevsrc(OBJREC *op, int sn, MAT4 pm);
193 > extern double   getdisk(FVECT oc, OBJREC *op, int sn);
194 > extern int      vstestvis(int f, OBJREC *o, FVECT oc, double or2, int sn);
195 > extern void     virtverb(int sn, FILE *fp);
196  
122 extern SPOT  *makespot();               /* make spotlight */
197  
198 < extern double  dstrsrc;                 /* source distribution amount */
199 < extern double  shadthresh;              /* relative shadow threshold */
200 < extern double  shadcert;                /* shadow testing certainty */
201 < extern double  srcsizerat;              /* max. ratio of source size/dist. */
128 < extern int  directrelay;                /* maximum number of source relays */
129 < extern int  vspretest;                  /* virtual source pretest density */
130 < extern int  directvis;                  /* sources visible? */
198 > #ifdef __cplusplus
199 > }
200 > #endif
201 > #endif /* _RAD_SOURCE_H_ */
202  
132 #define  getplaneq(c,o)         (*sfun[(o)->otype].of->getpleq)(c,o)
133 #define  getmaxdisk(c,o)        (*sfun[(o)->otype].of->getdisk)(c,o)
134 #define  setsource(s,o)         (*sfun[(o)->otype].of->setsrc)(s,o)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines