8 |
|
* 8/20/85 |
9 |
|
*/ |
10 |
|
|
11 |
+ |
#define AIMREQT 100 /* required aim success/failure */ |
12 |
+ |
|
13 |
|
#define SDISTANT 01 /* source distant flag */ |
14 |
|
#define SSKIP 02 /* source skip flag */ |
15 |
|
#define SPROX 04 /* source proximity flag */ |
16 |
|
#define SSPOT 010 /* source spotlight flag */ |
17 |
+ |
#define SVIRTUAL 020 /* source virtual flag */ |
18 |
+ |
#define SFLAT 040 /* source flat flag */ |
19 |
+ |
#define SFOLLOW 0100 /* source follow path flag */ |
20 |
|
|
16 |
– |
#define AIMREQT 100 /* required aim success/failure */ |
17 |
– |
|
21 |
|
typedef struct { |
22 |
< |
float siz; /* output solid angle */ |
22 |
> |
FVECT aim; /* aim direction or center */ |
23 |
> |
float siz; /* output solid angle or area */ |
24 |
|
float flen; /* focal length */ |
21 |
– |
FVECT aim; /* aim direction */ |
25 |
|
} SPOT; /* spotlight */ |
26 |
|
|
27 |
|
typedef struct { |
28 |
< |
short sflags; /* source flags */ |
28 |
> |
int sflags; /* source flags */ |
29 |
|
FVECT sloc; /* direction or position of source */ |
30 |
+ |
FVECT snorm; /* surface normal of flat source */ |
31 |
|
float ss; /* tangent or disk radius */ |
32 |
|
float ss2; /* domega or projected area */ |
33 |
< |
union { |
33 |
> |
struct { |
34 |
|
float prox; /* proximity */ |
35 |
|
SPOT *s; /* spot */ |
36 |
|
} sl; /* localized source information */ |
37 |
< |
int aimsuccess; /* aim successes - AIMREQT*failures */ |
37 |
> |
union { |
38 |
> |
int success; /* successes - AIMREQT*failures */ |
39 |
> |
int svnext; /* next source to aim for */ |
40 |
> |
} sa; /* source aiming information */ |
41 |
|
long ntests, nhits; /* shadow tests and hits */ |
42 |
< |
OBJREC *so; /* source object */ |
42 |
> |
OBJREC *so; /* source destination object */ |
43 |
|
} SRCREC; /* light source */ |
44 |
|
|
45 |
+ |
/* |
46 |
+ |
* Special support functions for sources |
47 |
+ |
*/ |
48 |
+ |
|
49 |
+ |
/* |
50 |
+ |
* Virtual source materials must support the following functions: |
51 |
+ |
* |
52 |
+ |
* vproj(pm, op, sp, i) Compute i'th virtual projection |
53 |
+ |
* of source sp in object op and assign |
54 |
+ |
* the 4x4 transformation matrix pm. |
55 |
+ |
* Return 1 on success, 0 if no i'th projection. |
56 |
+ |
* |
57 |
+ |
* nproj The number of projections. The value of |
58 |
+ |
* i passed to vproj runs from 0 to nproj-1. |
59 |
+ |
*/ |
60 |
+ |
|
61 |
|
typedef struct { |
62 |
< |
FVECT dir; /* source direction */ |
63 |
< |
float dom; /* domega for source */ |
64 |
< |
COLOR val; /* contribution */ |
42 |
< |
} CONTRIB; /* direct contribution */ |
62 |
> |
int (*vproj)(); /* project virtual sources */ |
63 |
> |
int nproj; /* number of possible projections */ |
64 |
> |
} VSMATERIAL; /* virtual source material functions */ |
65 |
|
|
66 |
|
typedef struct { |
67 |
< |
int sno; /* source number */ |
68 |
< |
float brt; /* brightness (for comparison) */ |
69 |
< |
} CNTPTR; /* contribution pointer */ |
67 |
> |
int (*setsrc)(); /* set light source for object */ |
68 |
> |
double (*getpleq)(); /* plane equation for surface */ |
69 |
> |
double (*getdisk)(); /* maximum disk for surface */ |
70 |
> |
} SOBJECT; /* source object functions */ |
71 |
|
|
72 |
+ |
typedef union { |
73 |
+ |
VSMATERIAL *mf; /* material functions */ |
74 |
+ |
SOBJECT *of; /* object functions */ |
75 |
+ |
} SRCFUNC; /* source functions */ |
76 |
+ |
|
77 |
+ |
extern SRCFUNC sfun[]; /* source dispatch table */ |
78 |
+ |
|
79 |
|
extern SRCREC *source; /* our source list */ |
80 |
|
extern int nsources; /* the number of sources */ |
81 |
|
|
82 |
|
extern double srcray(); /* ray to source */ |
83 |
|
|
84 |
|
extern SPOT *makespot(); /* make spotlight */ |
85 |
+ |
|
86 |
+ |
extern SRCREC *newsource(); /* allocate new source */ |
87 |
+ |
|
88 |
+ |
extern double dstrsrc; /* source distribution amount */ |
89 |
+ |
extern double shadthresh; /* relative shadow threshold */ |
90 |
+ |
extern double shadcert; /* shadow testing certainty */ |
91 |
+ |
extern int directrelay; /* maximum number of source relays */ |