ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/source.h
Revision: 1.13
Committed: Thu Jul 18 14:43:06 1991 UTC (32 years, 9 months ago) by greg
Content type: text/plain
Branch: MAIN
Changes since 1.12: +1 -0 lines
Log Message:
added -di option for direct source invisibility

File Contents

# User Rev Content
1 greg 1.1 /* Copyright (c) 1986 Regents of the University of California */
2    
3     /* SCCSid "$SunId$ LBL" */
4    
5     /*
6     * source.h - header file for ray tracing sources.
7     *
8     * 8/20/85
9     */
10    
11 greg 1.6 #define AIMREQT 100 /* required aim success/failure */
12    
13 greg 1.1 #define SDISTANT 01 /* source distant flag */
14     #define SSKIP 02 /* source skip flag */
15 greg 1.3 #define SPROX 04 /* source proximity flag */
16     #define SSPOT 010 /* source spotlight flag */
17 greg 1.6 #define SVIRTUAL 020 /* source virtual flag */
18     #define SFLAT 040 /* source flat flag */
19     #define SFOLLOW 0100 /* source follow path flag */
20 greg 1.1
21     typedef struct {
22 greg 1.6 FVECT aim; /* aim direction or center */
23     float siz; /* output solid angle or area */
24 greg 1.3 float flen; /* focal length */
25     } SPOT; /* spotlight */
26    
27     typedef struct {
28 greg 1.6 int sflags; /* source flags */
29 greg 1.1 FVECT sloc; /* direction or position of source */
30 greg 1.6 FVECT snorm; /* surface normal of flat source */
31 greg 1.1 float ss; /* tangent or disk radius */
32     float ss2; /* domega or projected area */
33 greg 1.6 struct {
34 greg 1.3 float prox; /* proximity */
35     SPOT *s; /* spot */
36     } sl; /* localized source information */
37 greg 1.6 union {
38     int success; /* successes - AIMREQT*failures */
39 greg 1.12 struct {
40     short pn; /* projection number */
41     short sn; /* next source to aim for */
42     } sv; /* virtual source */
43 greg 1.6 } sa; /* source aiming information */
44 greg 1.2 long ntests, nhits; /* shadow tests and hits */
45 greg 1.6 OBJREC *so; /* source destination object */
46 greg 1.2 } SRCREC; /* light source */
47 greg 1.1
48 greg 1.8 /*
49     * Special support functions for sources
50     */
51    
52     /*
53 greg 1.10 * Virtual source materials must define the following.
54 greg 1.8 *
55     * vproj(pm, op, sp, i) Compute i'th virtual projection
56     * of source sp in object op and assign
57     * the 4x4 transformation matrix pm.
58     * Return 1 on success, 0 if no i'th projection.
59     *
60     * nproj The number of projections. The value of
61     * i passed to vproj runs from 0 to nproj-1.
62     */
63    
64 greg 1.2 typedef struct {
65 greg 1.8 int (*vproj)(); /* project virtual sources */
66     int nproj; /* number of possible projections */
67     } VSMATERIAL; /* virtual source material functions */
68 greg 1.4
69     typedef struct {
70 greg 1.8 int (*setsrc)(); /* set light source for object */
71     double (*getpleq)(); /* plane equation for surface */
72     double (*getdisk)(); /* maximum disk for surface */
73     } SOBJECT; /* source object functions */
74 greg 1.1
75 greg 1.8 typedef union {
76     VSMATERIAL *mf; /* material functions */
77     SOBJECT *of; /* object functions */
78     } SRCFUNC; /* source functions */
79    
80     extern SRCFUNC sfun[]; /* source dispatch table */
81    
82 greg 1.2 extern SRCREC *source; /* our source list */
83 greg 1.1 extern int nsources; /* the number of sources */
84    
85 greg 1.2 extern double srcray(); /* ray to source */
86 greg 1.10 extern int srcvalue(); /* compute source value w/o shadows */
87 greg 1.3
88 greg 1.10 extern double intercircle(); /* intersect two circles */
89 greg 1.11 extern double spotdisk(); /* intersecting disk for spot */
90     extern double beamdisk(); /* intersecting disk for beam */
91 greg 1.10
92 greg 1.3 extern SPOT *makespot(); /* make spotlight */
93 greg 1.6
94 greg 1.8 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 greg 1.10 extern int vspretest; /* virtual source pretest density */
99 greg 1.13 extern int directinvis; /* sources invisible? */
100 greg 1.11
101     #define getplaneq(c,o) (*sfun[(o)->otype].of->getpleq)(c,o)
102     #define getmaxdisk(c,o) (*sfun[(o)->otype].of->getdisk)(c,o)
103     #define setsource(s,o) (*sfun[(o)->otype].of->setsrc)(s,o)