4 |
|
* |
5 |
|
* Include after ray.h |
6 |
|
*/ |
7 |
+ |
#ifndef _RAD_SOURCE_H_ |
8 |
+ |
#define _RAD_SOURCE_H_ |
9 |
|
|
10 |
< |
#include "copyright.h" |
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 */ |
36 |
|
} SPOT; /* spotlight */ |
37 |
|
|
38 |
|
typedef struct { |
39 |
< |
int sflags; /* source flags */ |
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 |
|
FVECT sloc; /* direction or position of source */ |
54 |
|
FVECT ss[3]; /* source dimension vectors, U, V, and W */ |
55 |
|
float srad; /* maximum source radius */ |
56 |
|
float ss2; /* solid angle or projected area */ |
57 |
+ |
OBJREC *so; /* source destination object */ |
58 |
|
struct { |
59 |
|
float prox; /* proximity */ |
60 |
|
SPOT *s; /* spot */ |
66 |
|
int sn; /* next source to aim for */ |
67 |
|
} sv; /* virtual source */ |
68 |
|
} sa; /* source aiming information */ |
69 |
< |
long ntests, nhits; /* shadow tests and hits */ |
70 |
< |
OBJREC *so; /* source destination object */ |
69 |
> |
unsigned long |
70 |
> |
ntests, nhits; /* shadow tests and hits */ |
71 |
> |
#ifdef SHADCACHE |
72 |
> |
OBSCACHE *obscache; /* obstructor cache */ |
73 |
> |
#endif |
74 |
> |
int sflags; /* source flags */ |
75 |
|
} SRCREC; /* light source */ |
76 |
|
|
77 |
|
#define MAXSPART 64 /* maximum partitions per source */ |
84 |
|
#define snorm ss[SW] /* normal vector for flat source */ |
85 |
|
|
86 |
|
typedef struct { |
87 |
+ |
double dom; /* solid angle of partition */ |
88 |
|
int sn; /* source number */ |
89 |
|
short np; /* number of partitions */ |
90 |
|
short sp; /* this partition number */ |
61 |
– |
double dom; /* solid angle of partition */ |
91 |
|
unsigned char spt[MAXSPART/2]; /* source partitioning */ |
92 |
|
} SRCINDEX; /* source index structure */ |
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 |
|
|
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 |
|
|
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 |
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 |
< |
extern void direct(RAY *r, void (*f)(), char *p); |
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 initobscache(int sn); |
156 |
+ |
extern int srcblocker(RAY *r); |
157 |
+ |
extern int srcblocked(RAY *r); |
158 |
+ |
extern void freeobscache(SRCREC *s); |
159 |
|
/* defined in srcsamp.c */ |
160 |
|
extern double nextssamp(RAY *r, SRCINDEX *si); |
161 |
|
extern int skipparts(int ct[3], int sz[3], int pp[2], unsigned char *pt); |
195 |
|
extern int vstestvis(int f, OBJREC *o, FVECT oc, double or2, int sn); |
196 |
|
extern void virtverb(int sn, FILE *fp); |
197 |
|
|
198 |
+ |
|
199 |
+ |
#ifdef __cplusplus |
200 |
+ |
} |
201 |
|
#endif |
202 |
+ |
#endif /* _RAD_SOURCE_H_ */ |
203 |
+ |
|