16 |
|
#include "random.h" |
17 |
|
|
18 |
|
|
19 |
< |
static int |
20 |
< |
srcskip( /* pre-emptive test for out-of-range glow */ |
21 |
< |
SRCREC *sp, |
22 |
< |
FVECT orig |
19 |
> |
int |
20 |
> |
srcskip( /* pre-emptive test for source to skip */ |
21 |
> |
int sn, |
22 |
> |
RAY *r |
23 |
|
) |
24 |
|
{ |
25 |
+ |
SRCREC *sp = source + sn; |
26 |
+ |
|
27 |
|
if (sp->sflags & SSKIP) |
28 |
|
return(1); |
29 |
|
|
30 |
|
if ((sp->sflags & (SPROX|SDISTANT)) != SPROX) |
31 |
|
return(0); |
32 |
|
|
33 |
< |
return(dist2(orig, sp->sloc) > |
33 |
> |
return(dist2(r->rorg, sp->sloc) > |
34 |
|
(sp->sl.prox + sp->srad)*(sp->sl.prox + sp->srad)); |
35 |
|
} |
36 |
|
|
37 |
|
double |
38 |
|
nextssamp( /* compute sample for source, rtn. distance */ |
39 |
|
RAY *r, /* origin is read, direction is set */ |
40 |
< |
SRCINDEX *si /* source index (modified to current) */\ |
40 |
> |
SRCINDEX *si /* source index (modified to current) */ |
41 |
|
) |
42 |
|
{ |
43 |
|
int cent[3], size[3], parr[2]; |
49 |
|
while (++si->sp >= si->np) { /* get next sample */ |
50 |
|
if (++si->sn >= nsources) |
51 |
|
return(0.0); /* no more */ |
52 |
< |
if (srcskip(source+si->sn, r->rorg)) |
52 |
> |
if (srcskip(si->sn, r)) |
53 |
|
si->np = 0; |
54 |
|
else if (srcsizerat <= FTINY) |
55 |
|
nopart(si, r); |