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 */ |
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 { |
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 */ |
50 |
> |
unsigned long |
51 |
> |
ntests, nhits; /* shadow tests and hits */ |
52 |
|
OBJREC *so; /* source destination object */ |
53 |
|
} SRCREC; /* light source */ |
54 |
|
|
97 |
|
} VSMATERIAL; /* virtual source material functions */ |
98 |
|
|
99 |
|
typedef struct { |
100 |
< |
int (*setsrc)(); /* set light source for object */ |
101 |
< |
int (*partit)(); /* partition light source object */ |
100 |
> |
void (*setsrc)(); /* set light source for object */ |
101 |
> |
void (*partit)(); /* partition light source object */ |
102 |
|
double (*getpleq)(); /* plane equation for surface */ |
103 |
|
double (*getdisk)(); /* maximum disk for surface */ |
104 |
|
} SOBJECT; /* source object functions */ |
113 |
|
extern SRCREC *source; /* our source list */ |
114 |
|
extern int nsources; /* the number of sources */ |
115 |
|
|
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 |
– |
|
116 |
|
#define sflatform(sn,dir) -DOT(source[sn].snorm, dir) |
117 |
|
|
118 |
< |
extern OBJREC *vsmaterial(); /* virtual source material */ |
118 |
> |
#define getplaneq(c,o) (*sfun[(o)->otype].of->getpleq)(c,o) |
119 |
> |
#define getmaxdisk(c,o) (*sfun[(o)->otype].of->getdisk)(c,o) |
120 |
> |
#define setsource(s,o) (*sfun[(o)->otype].of->setsrc)(s,o) |
121 |
|
|
122 |
< |
extern double intercircle(); /* intersect two circles */ |
123 |
< |
extern double spotdisk(); /* intersecting disk for spot */ |
124 |
< |
extern double beamdisk(); /* intersecting disk for beam */ |
122 |
> |
/* defined in source.c */ |
123 |
> |
extern void marksources(void); |
124 |
> |
extern void freesources(void); |
125 |
> |
extern int srcray(RAY *sr, RAY *r, SRCINDEX *si); |
126 |
> |
extern void srcvalue(RAY *r); |
127 |
> |
extern int sourcehit(RAY *r); |
128 |
> |
extern void direct(RAY *r, void (*f)(), char *p); |
129 |
> |
extern void srcscatter(RAY *r); |
130 |
> |
extern int m_light(OBJREC *m, RAY *r); |
131 |
> |
/* defined in srcsamp.c */ |
132 |
> |
extern double nextssamp(RAY *r, SRCINDEX *si); |
133 |
> |
extern int skipparts(int ct[3], int sz[3], int pp[2], unsigned char *pt); |
134 |
> |
extern void nopart(SRCINDEX *si, RAY *r); |
135 |
> |
extern void cylpart(SRCINDEX *si, RAY *r); |
136 |
> |
extern void flatpart(SRCINDEX *si, RAY *r); |
137 |
> |
extern double scylform(int sn, FVECT dir); |
138 |
> |
/* defined in srcsupp.c */ |
139 |
> |
extern void initstypes(void); |
140 |
> |
extern int newsource(void); |
141 |
> |
extern void setflatss(SRCREC *src); |
142 |
> |
extern void fsetsrc(SRCREC *src, OBJREC *so); |
143 |
> |
extern void ssetsrc(SRCREC *src, OBJREC *so); |
144 |
> |
extern void sphsetsrc(SRCREC *src, OBJREC *so); |
145 |
> |
extern void rsetsrc(SRCREC *src, OBJREC *so); |
146 |
> |
extern void cylsetsrc(SRCREC *src, OBJREC *so); |
147 |
> |
extern SPOT *makespot(OBJREC *m); |
148 |
> |
extern int spotout(RAY *r, SPOT *s); |
149 |
> |
extern double fgetmaxdisk(FVECT ocent, OBJREC *op); |
150 |
> |
extern double rgetmaxdisk(FVECT ocent, OBJREC *op); |
151 |
> |
extern double fgetplaneq(FVECT nvec, OBJREC *op); |
152 |
> |
extern double rgetplaneq(FVECT nvec, OBJREC *op); |
153 |
> |
extern int commonspot(SPOT *sp1, SPOT *sp2, FVECT org); |
154 |
> |
extern int commonbeam(SPOT *sp1, SPOT *sp2, FVECT org); |
155 |
> |
extern int checkspot(SPOT *sp, FVECT nrm); |
156 |
> |
extern double spotdisk(FVECT oc, OBJREC *op, SPOT *sp, FVECT pos); |
157 |
> |
extern double beamdisk(FVECT oc, OBJREC *op, SPOT *sp, FVECT dir); |
158 |
> |
extern double intercircle(FVECT cc, FVECT c1, FVECT c2, |
159 |
> |
double r1s, double r2s); |
160 |
> |
/* defined in virtuals.c */ |
161 |
> |
extern void markvirtuals(void); |
162 |
> |
extern void addvirtuals(int sn, int nr); |
163 |
> |
extern void vproject(OBJREC *o, int sn, int n); |
164 |
> |
extern OBJREC *vsmaterial(OBJREC *o); |
165 |
> |
extern int makevsrc(OBJREC *op, int sn, MAT4 pm); |
166 |
> |
extern double getdisk(FVECT oc, OBJREC *op, int sn); |
167 |
> |
extern int vstestvis(int f, OBJREC *o, FVECT oc, double or2, int sn); |
168 |
> |
extern void virtverb(int sn, FILE *fp); |
169 |
|
|
122 |
– |
extern SPOT *makespot(); /* make spotlight */ |
170 |
|
|
171 |
< |
extern double dstrsrc; /* source distribution amount */ |
172 |
< |
extern double shadthresh; /* relative shadow threshold */ |
173 |
< |
extern double shadcert; /* shadow testing certainty */ |
174 |
< |
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 directinvis; /* sources invisible? */ |
171 |
> |
#ifdef __cplusplus |
172 |
> |
} |
173 |
> |
#endif |
174 |
> |
#endif /* _RAD_SOURCE_H_ */ |
175 |
|
|
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) |