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 |
|
|
8 |
+ |
#include "copyright.h" |
9 |
+ |
|
10 |
|
#define AIMREQT 100 /* required aim success/failure */ |
11 |
|
|
12 |
|
#define SDISTANT 01 /* source distant flag */ |
21 |
|
typedef struct { |
22 |
|
FVECT aim; /* aim direction or center */ |
23 |
|
float siz; /* output solid angle or area */ |
24 |
< |
float flen; /* focal length */ |
24 |
> |
float flen; /* focal length (negative if distant source) */ |
25 |
|
} SPOT; /* spotlight */ |
26 |
|
|
27 |
|
typedef struct { |
35 |
|
SPOT *s; /* spot */ |
36 |
|
} sl; /* localized source information */ |
37 |
|
union { |
38 |
< |
int success; /* successes - AIMREQT*failures */ |
38 |
> |
long success; /* successes - AIMREQT*failures */ |
39 |
|
struct { |
40 |
|
short pn; /* projection number */ |
41 |
< |
short sn; /* next source to aim for */ |
41 |
> |
int sn; /* next source to aim for */ |
42 |
|
} sv; /* virtual source */ |
43 |
|
} sa; /* source aiming information */ |
44 |
|
long ntests, nhits; /* shadow tests and hits */ |
90 |
|
} VSMATERIAL; /* virtual source material functions */ |
91 |
|
|
92 |
|
typedef struct { |
93 |
< |
int (*setsrc)(); /* set light source for object */ |
94 |
< |
int (*partit)(); /* partition light source object */ |
93 |
> |
void (*setsrc)(); /* set light source for object */ |
94 |
> |
void (*partit)(); /* partition light source object */ |
95 |
|
double (*getpleq)(); /* plane equation for surface */ |
96 |
|
double (*getdisk)(); /* maximum disk for surface */ |
97 |
|
} SOBJECT; /* source object functions */ |
106 |
|
extern SRCREC *source; /* our source list */ |
107 |
|
extern int nsources; /* the number of sources */ |
108 |
|
|
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 |
– |
|
109 |
|
#define sflatform(sn,dir) -DOT(source[sn].snorm, dir) |
110 |
|
|
116 |
– |
extern double intercircle(); /* intersect two circles */ |
117 |
– |
extern double spotdisk(); /* intersecting disk for spot */ |
118 |
– |
extern double beamdisk(); /* intersecting disk for beam */ |
119 |
– |
|
120 |
– |
extern SPOT *makespot(); /* make spotlight */ |
121 |
– |
|
122 |
– |
extern double dstrsrc; /* source distribution amount */ |
123 |
– |
extern double shadthresh; /* relative shadow threshold */ |
124 |
– |
extern double shadcert; /* shadow testing certainty */ |
125 |
– |
extern double srcsizerat; /* max. ratio of source size/dist. */ |
126 |
– |
extern int directrelay; /* maximum number of source relays */ |
127 |
– |
extern int vspretest; /* virtual source pretest density */ |
128 |
– |
extern int directinvis; /* sources invisible? */ |
129 |
– |
|
111 |
|
#define getplaneq(c,o) (*sfun[(o)->otype].of->getpleq)(c,o) |
112 |
|
#define getmaxdisk(c,o) (*sfun[(o)->otype].of->getdisk)(c,o) |
113 |
|
#define setsource(s,o) (*sfun[(o)->otype].of->setsrc)(s,o) |
114 |
+ |
|
115 |
+ |
#ifdef NOPROTO |
116 |
+ |
|
117 |
+ |
extern void marksources(); |
118 |
+ |
extern void freesources(); |
119 |
+ |
extern int srcray(); |
120 |
+ |
extern void srcvalue(); |
121 |
+ |
extern int sourcehit(); |
122 |
+ |
extern void direct(); |
123 |
+ |
extern void srcscatter(); |
124 |
+ |
extern int m_light(); |
125 |
+ |
extern double nextssamp(); |
126 |
+ |
extern int skipparts(); |
127 |
+ |
extern void nopart(); |
128 |
+ |
extern void cylpart(); |
129 |
+ |
extern void flatpart(); |
130 |
+ |
extern double scylform(); |
131 |
+ |
extern void initstypes(); |
132 |
+ |
extern int newsource(); |
133 |
+ |
extern void setflatss(); |
134 |
+ |
extern void fsetsrc(); |
135 |
+ |
extern void ssetsrc(); |
136 |
+ |
extern void sphsetsrc(); |
137 |
+ |
extern void rsetsrc(); |
138 |
+ |
extern void cylsetsrc(); |
139 |
+ |
extern SPOT *makespot(); |
140 |
+ |
extern int spotout(); |
141 |
+ |
extern double fgetmaxdisk(); |
142 |
+ |
extern double rgetmaxdisk(); |
143 |
+ |
extern double fgetplaneq(); |
144 |
+ |
extern double rgetplaneq(); |
145 |
+ |
extern int commonspot(); |
146 |
+ |
extern int commonbeam(); |
147 |
+ |
extern int checkspot(); |
148 |
+ |
extern double spotdisk(); |
149 |
+ |
extern double beamdisk(); |
150 |
+ |
extern double intercircle(); |
151 |
+ |
extern void markvirtuals(); |
152 |
+ |
extern void addvirtuals(); |
153 |
+ |
extern void vproject(); |
154 |
+ |
extern OBJREC *vsmaterial(); |
155 |
+ |
extern int makevsrc(); |
156 |
+ |
extern double getdisk(); |
157 |
+ |
extern int vstestvis(); |
158 |
+ |
extern void virtverb(); |
159 |
+ |
|
160 |
+ |
#else |
161 |
+ |
/* defined in source.c */ |
162 |
+ |
extern void marksources(void); |
163 |
+ |
extern void freesources(void); |
164 |
+ |
extern int srcray(RAY *sr, RAY *r, SRCINDEX *si); |
165 |
+ |
extern void srcvalue(RAY *r); |
166 |
+ |
extern int sourcehit(RAY *r); |
167 |
+ |
extern void direct(RAY *r, void (*f)(), char *p); |
168 |
+ |
extern void srcscatter(RAY *r); |
169 |
+ |
extern int m_light(OBJREC *m, RAY *r); |
170 |
+ |
/* defined in srcsamp.c */ |
171 |
+ |
extern double nextssamp(RAY *r, SRCINDEX *si); |
172 |
+ |
extern int skipparts(int ct[3], int sz[3], int pp[2], unsigned char *pt); |
173 |
+ |
extern void nopart(SRCINDEX *si, RAY *r); |
174 |
+ |
extern void cylpart(SRCINDEX *si, RAY *r); |
175 |
+ |
extern void flatpart(SRCINDEX *si, RAY *r); |
176 |
+ |
extern double scylform(int sn, FVECT dir); |
177 |
+ |
/* defined in srcsupp.c */ |
178 |
+ |
extern void initstypes(void); |
179 |
+ |
extern int newsource(void); |
180 |
+ |
extern void setflatss(SRCREC *src); |
181 |
+ |
extern void fsetsrc(SRCREC *src, OBJREC *so); |
182 |
+ |
extern void ssetsrc(SRCREC *src, OBJREC *so); |
183 |
+ |
extern void sphsetsrc(SRCREC *src, OBJREC *so); |
184 |
+ |
extern void rsetsrc(SRCREC *src, OBJREC *so); |
185 |
+ |
extern void cylsetsrc(SRCREC *src, OBJREC *so); |
186 |
+ |
extern SPOT *makespot(OBJREC *m); |
187 |
+ |
extern int spotout(RAY *r, SPOT *s); |
188 |
+ |
extern double fgetmaxdisk(FVECT ocent, OBJREC *op); |
189 |
+ |
extern double rgetmaxdisk(FVECT ocent, OBJREC *op); |
190 |
+ |
extern double fgetplaneq(FVECT nvec, OBJREC *op); |
191 |
+ |
extern double rgetplaneq(FVECT nvec, OBJREC *op); |
192 |
+ |
extern int commonspot(SPOT *sp1, SPOT *sp2, FVECT org); |
193 |
+ |
extern int commonbeam(SPOT *sp1, SPOT *sp2, FVECT org); |
194 |
+ |
extern int checkspot(SPOT *sp, FVECT nrm); |
195 |
+ |
extern double spotdisk(FVECT oc, OBJREC *op, SPOT *sp, FVECT pos); |
196 |
+ |
extern double beamdisk(FVECT oc, OBJREC *op, SPOT *sp, FVECT dir); |
197 |
+ |
extern double intercircle(FVECT cc, FVECT c1, FVECT c2, |
198 |
+ |
double r1s, double r2s); |
199 |
+ |
/* defined in virtuals.c */ |
200 |
+ |
extern void markvirtuals(void); |
201 |
+ |
extern void addvirtuals(int sn, int nr); |
202 |
+ |
extern void vproject(OBJREC *o, int sn, int n); |
203 |
+ |
extern OBJREC *vsmaterial(OBJREC *o); |
204 |
+ |
extern int makevsrc(OBJREC *op, int sn, MAT4 pm); |
205 |
+ |
extern double getdisk(FVECT oc, OBJREC *op, int sn); |
206 |
+ |
extern int vstestvis(int f, OBJREC *o, FVECT oc, double or2, int sn); |
207 |
+ |
extern void virtverb(int sn, FILE *fp); |
208 |
+ |
|
209 |
+ |
#endif |