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 1.13 by greg, Thu Jul 18 14:43:06 1991 UTC vs.
Revision 2.7 by schorsch, Sat Jun 7 00:54:58 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 +
14 + #include "copyright.h"
15 +
16   #define  AIMREQT        100             /* required aim success/failure */
17  
18   #define  SDISTANT       01              /* source distant flag */
# Line 16 | Line 21
21   #define  SSPOT          010             /* source spotlight flag */
22   #define  SVIRTUAL       020             /* source virtual flag */
23   #define  SFLAT          040             /* source flat flag */
24 < #define  SFOLLOW        0100            /* source follow path flag */
24 > #define  SCYL           0100            /* source cylindrical flag */
25 > #define  SFOLLOW        0200            /* source follow path flag */
26  
27   typedef struct {
28          FVECT  aim;             /* aim direction or center */
29          float  siz;             /* output solid angle or area */
30 <        float  flen;            /* focal length */
30 >        float  flen;            /* focal length (negative if distant source) */
31   } SPOT;                 /* spotlight */
32  
33   typedef struct {
34          int  sflags;            /* source flags */
35          FVECT  sloc;            /* direction or position of source */
36 <        FVECT  snorm;           /* surface normal of flat source */
37 <        float  ss;              /* tangent or disk radius */
38 <        float  ss2;             /* domega or projected area */
36 >        FVECT  ss[3];           /* source dimension vectors, U, V, and W */
37 >        float  srad;            /* maximum source radius */
38 >        float  ss2;             /* solid angle or projected area */
39          struct {
40                  float  prox;            /* proximity */
41                  SPOT  *s;               /* spot */
42          } sl;                   /* localized source information */
43          union {
44 <                int  success;           /* successes - AIMREQT*failures */
44 >                long  success;          /* successes - AIMREQT*failures */
45                  struct {
46                          short  pn;              /* projection number */
47 <                        short  sn;              /* next source to aim for */
47 >                        int  sn;                /* next source to aim for */
48                  }  sv;                  /* virtual source */
49          } sa;                   /* source aiming information */
50          long  ntests, nhits;    /* shadow tests and hits */
51          OBJREC  *so;            /* source destination object */
52   }  SRCREC;              /* light source */
53  
54 + #define MAXSPART        64              /* maximum partitions per source */
55 +
56 + #define SU              0               /* U vector or partition */
57 + #define SV              1               /* V vector or partition */
58 + #define SW              2               /* W vector or partition */
59 + #define S0              3               /* leaf partition */
60 +
61 + #define snorm           ss[SW]          /* normal vector for flat source */
62 +
63 + typedef struct {
64 +        int  sn;                                /* source number */
65 +        short  np;                              /* number of partitions */
66 +        short  sp;                              /* this partition number */
67 +        double  dom;                            /* solid angle of partition */
68 +        unsigned char  spt[MAXSPART/2];         /* source partitioning */
69 + }  SRCINDEX;            /* source index structure */
70 +
71 + #define initsrcindex(s) ((s)->sn = (s)->sp = -1, (s)->np = 0)
72 +
73 + #define clrpart(pt)     bzero((char *)(pt), 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 +
77   /*
78   * Special support functions for sources
79   */
# Line 67 | Line 96 | typedef struct {
96   } VSMATERIAL;           /* virtual source material functions */
97  
98   typedef struct {
99 <        int     (*setsrc)();    /* set light source for 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 82 | Line 112 | extern SRCFUNC  sfun[];                        /* source dispatch table */
112   extern SRCREC  *source;                 /* our source list */
113   extern int  nsources;                   /* the number of sources */
114  
115 < extern double  srcray();                /* ray to source */
86 < extern int  srcvalue();                 /* compute source value w/o shadows */
115 > #define  sflatform(sn,dir)      -DOT(source[sn].snorm, dir)
116  
88 extern double  intercircle();           /* intersect two circles */
89 extern double  spotdisk();              /* intersecting disk for spot */
90 extern double  beamdisk();              /* intersecting disk for beam */
91
92 extern SPOT  *makespot();               /* make spotlight */
93
94 extern double  dstrsrc;                 /* source distribution amount */
95 extern double  shadthresh;              /* relative shadow threshold */
96 extern double  shadcert;                /* shadow testing certainty */
97 extern int  directrelay;                /* maximum number of source relays */
98 extern int  vspretest;                  /* virtual source pretest density */
99 extern int  directinvis;                /* sources invisible? */
100
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 +                                        /* 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 +
169 +
170 + #ifdef __cplusplus
171 + }
172 + #endif
173 + #endif /* _RAD_SOURCE_H_ */
174 +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines