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.3 by greg, Tue Jul 25 16:42:31 1995 UTC vs.
Revision 2.10 by schorsch, Mon Jun 30 14:59:13 2003 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   *  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 + #ifdef __cplusplus
10 + extern "C" {
11 + #endif
12  
13 + #include <string.h>
14 +
15   #define  AIMREQT        100             /* required aim success/failure */
16  
17   #define  SDISTANT       01              /* source distant flag */
# Line 22 | Line 26
26   typedef struct {
27          FVECT  aim;             /* aim direction or center */
28          float  siz;             /* output solid angle or area */
29 <        float  flen;            /* focal length */
29 >        float  flen;            /* focal length (negative if distant source) */
30   } SPOT;                 /* spotlight */
31  
32   typedef struct {
# Line 42 | Line 46 | typedef struct {
46                          int  sn;                /* next source to aim for */
47                  }  sv;                  /* virtual source */
48          } sa;                   /* source aiming information */
49 <        long  ntests, nhits;    /* shadow tests and hits */
49 >        unsigned long
50 >                ntests, nhits;  /* shadow tests and hits */
51          OBJREC  *so;            /* source destination object */
52   }  SRCREC;              /* light source */
53  
# Line 65 | Line 70 | typedef struct {
70  
71   #define initsrcindex(s) ((s)->sn = (s)->sp = -1, (s)->np = 0)
72  
73 < #define clrpart(pt)     bzero((char *)(pt), MAXSPART/2)
73 > #define clrpart(pt)     memset((char *)(pt), '\0', MAXSPART/2)
74   #define setpart(pt,i,v) ((pt)[(i)>>2] |= (v)<<(((i)&3)<<1))
75   #define spart(pt,pi)    ((pt)[(pi)>>2] >> (((pi)&3)<<1) & 3)
76  
# Line 91 | Line 96 | typedef struct {
96   } VSMATERIAL;           /* virtual source material functions */
97  
98   typedef struct {
99 <        int     (*setsrc)();    /* set light source for object */
100 <        int     (*partit)();    /* partition light source object */
99 >        void    (*setsrc)();    /* set light source for object */
100 >        void    (*partit)();    /* partition light source object */
101          double  (*getpleq)();   /* plane equation for surface */
102          double  (*getdisk)();   /* maximum disk for surface */
103   } SOBJECT;              /* source object functions */
# Line 107 | Line 112 | extern SRCFUNC  sfun[];                        /* source dispatch table */
112   extern SRCREC  *source;                 /* our source list */
113   extern int  nsources;                   /* the number of sources */
114  
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
115   #define  sflatform(sn,dir)      -DOT(source[sn].snorm, dir)
116  
117 < extern OBJREC  *vsmaterial();           /* virtual source material */
117 > #define  getplaneq(c,o)         (*sfun[(o)->otype].of->getpleq)(c,o)
118 > #define  getmaxdisk(c,o)        (*sfun[(o)->otype].of->getdisk)(c,o)
119 > #define  setsource(s,o)         (*sfun[(o)->otype].of->setsrc)(s,o)
120  
121 < extern double  intercircle();           /* intersect two circles */
122 < extern double  spotdisk();              /* intersecting disk for spot */
123 < extern double  beamdisk();              /* intersecting disk for beam */
121 >                                        /* defined in source.c */
122 > extern void     marksources(void);
123 > extern void     freesources(void);
124 > extern int      srcray(RAY *sr, RAY *r, SRCINDEX *si);
125 > extern void     srcvalue(RAY *r);
126 > extern int      sourcehit(RAY *r);
127 > extern void     direct(RAY *r, void (*f)(), char *p);
128 > extern void     srcscatter(RAY *r);
129 > extern int      m_light(OBJREC *m, RAY *r);
130 >                                        /* defined in srcsamp.c */
131 > extern double   nextssamp(RAY *r, SRCINDEX *si);
132 > extern int      skipparts(int ct[3], int sz[3], int pp[2], unsigned char *pt);
133 > extern void     nopart(SRCINDEX *si, RAY *r);
134 > extern void     cylpart(SRCINDEX *si, RAY *r);
135 > extern void     flatpart(SRCINDEX *si, RAY *r);
136 > extern double   scylform(int sn, FVECT dir);
137 >                                        /* defined in srcsupp.c */
138 > extern void     initstypes(void);
139 > extern int      newsource(void);
140 > extern void     setflatss(SRCREC *src);
141 > extern void     fsetsrc(SRCREC *src, OBJREC *so);
142 > extern void     ssetsrc(SRCREC *src, OBJREC *so);
143 > extern void     sphsetsrc(SRCREC *src, OBJREC *so);
144 > extern void     rsetsrc(SRCREC *src, OBJREC *so);
145 > extern void     cylsetsrc(SRCREC *src, OBJREC *so);
146 > extern SPOT     *makespot(OBJREC *m);
147 > extern int      spotout(RAY *r, SPOT *s);
148 > extern double   fgetmaxdisk(FVECT ocent, OBJREC *op);
149 > extern double   rgetmaxdisk(FVECT ocent, OBJREC *op);
150 > extern double   fgetplaneq(FVECT nvec, OBJREC *op);
151 > extern double   rgetplaneq(FVECT nvec, OBJREC *op);
152 > extern int      commonspot(SPOT *sp1, SPOT *sp2, FVECT org);
153 > extern int      commonbeam(SPOT *sp1, SPOT *sp2, FVECT org);
154 > extern int      checkspot(SPOT *sp, FVECT nrm);
155 > extern double   spotdisk(FVECT oc, OBJREC *op, SPOT *sp, FVECT pos);
156 > extern double   beamdisk(FVECT oc, OBJREC *op, SPOT *sp, FVECT dir);
157 > extern double   intercircle(FVECT cc, FVECT c1, FVECT c2,
158 >                        double r1s, double r2s);
159 >                                        /* defined in virtuals.c */
160 > extern void     markvirtuals(void);
161 > extern void     addvirtuals(int sn, int nr);
162 > extern void     vproject(OBJREC *o, int sn, int n);
163 > extern OBJREC   *vsmaterial(OBJREC *o);
164 > extern int      makevsrc(OBJREC *op, int sn, MAT4 pm);
165 > extern double   getdisk(FVECT oc, OBJREC *op, int sn);
166 > extern int      vstestvis(int f, OBJREC *o, FVECT oc, double or2, int sn);
167 > extern void     virtverb(int sn, FILE *fp);
168  
122 extern SPOT  *makespot();               /* make spotlight */
169  
170 < extern double  dstrsrc;                 /* source distribution amount */
171 < extern double  shadthresh;              /* relative shadow threshold */
172 < extern double  shadcert;                /* shadow testing certainty */
173 < 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? */
170 > #ifdef __cplusplus
171 > }
172 > #endif
173 > #endif /* _RAD_SOURCE_H_ */
174  
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