1 |
– |
/* Copyright (c) 1998 Silicon Graphics, Inc. */ |
2 |
– |
|
1 |
|
#ifndef lint |
2 |
< |
static char SCCSid[] = "$SunId$ SGI"; |
2 |
> |
static const char RCSid[] = "$Id$"; |
3 |
|
#endif |
6 |
– |
|
4 |
|
/* |
5 |
|
* source.c - routines dealing with illumination sources. |
6 |
|
* |
7 |
< |
* 8/20/85 |
7 |
> |
* External symbols declared in source.h |
8 |
|
*/ |
9 |
|
|
10 |
+ |
#include "copyright.h" |
11 |
+ |
|
12 |
|
#include "ray.h" |
13 |
|
|
15 |
– |
#include "octree.h" |
16 |
– |
|
14 |
|
#include "otypes.h" |
15 |
|
|
16 |
|
#include "source.h" |
44 |
|
static int maxcntr = 0; /* size of contribution arrays */ |
45 |
|
|
46 |
|
|
47 |
+ |
void |
48 |
|
marksources() /* find and mark source objects */ |
49 |
|
{ |
50 |
|
int foundsource = 0; |
123 |
|
} |
124 |
|
|
125 |
|
|
126 |
+ |
void |
127 |
+ |
freesources() /* free all source structures */ |
128 |
+ |
{ |
129 |
+ |
if (nsources > 0) { |
130 |
+ |
free((void *)source); |
131 |
+ |
source = NULL; |
132 |
+ |
nsources = 0; |
133 |
+ |
} |
134 |
+ |
if (maxcntr <= 0) |
135 |
+ |
return; |
136 |
+ |
free((void *)srccnt); |
137 |
+ |
srccnt = NULL; |
138 |
+ |
free((void *)cntord); |
139 |
+ |
cntord = NULL; |
140 |
+ |
maxcntr = 0; |
141 |
+ |
} |
142 |
+ |
|
143 |
+ |
|
144 |
+ |
int |
145 |
|
srcray(sr, r, si) /* send a ray to a source, return domega */ |
146 |
|
register RAY *sr; /* returned source ray */ |
147 |
|
RAY *r; /* ray which hit object */ |
179 |
|
} |
180 |
|
|
181 |
|
|
182 |
+ |
void |
183 |
|
srcvalue(r) /* punch ray to source and compute value */ |
184 |
|
register RAY *r; |
185 |
|
{ |
220 |
|
} |
221 |
|
|
222 |
|
|
223 |
+ |
int |
224 |
|
sourcehit(r) /* check to see if ray hit distant source */ |
225 |
|
register RAY *r; |
226 |
|
{ |
269 |
|
} |
270 |
|
|
271 |
|
|
272 |
+ |
void |
273 |
|
direct(r, f, p) /* add direct component */ |
274 |
|
RAY *r; /* ray that hit surface */ |
275 |
< |
int (*f)(); /* direct component coefficient function */ |
275 |
> |
void (*f)(); /* direct component coefficient function */ |
276 |
|
char *p; /* data for f */ |
277 |
|
{ |
278 |
< |
extern int (*trace)(); |
278 |
> |
extern void (*trace)(); |
279 |
|
register int sn; |
280 |
|
register CONTRIB *scp; |
281 |
|
SRCINDEX si; |
395 |
|
} |
396 |
|
|
397 |
|
|
398 |
+ |
void |
399 |
|
srcscatter(r) /* compute source scattering into ray */ |
400 |
|
register RAY *r; |
401 |
|
{ |
547 |
|
distglow(m, r, raydist(r,PRIMARY))) |
548 |
|
|
549 |
|
|
550 |
+ |
int |
551 |
|
m_light(m, r) /* ray hit a light source */ |
552 |
|
register OBJREC *m; |
553 |
|
register RAY *r; |