| 200 |
|
while (nsources--) |
| 201 |
|
freeobscache(&source[nsources]); |
| 202 |
|
#endif |
| 203 |
– |
#ifdef SSKIPOPT |
| 204 |
– |
sskip_rsi(NULL); |
| 205 |
– |
#endif |
| 203 |
|
free(source); |
| 204 |
|
source = NULL; |
| 205 |
|
nsources = 0; |
| 216 |
|
|
| 217 |
|
|
| 218 |
|
int |
| 219 |
< |
srcray( /* send a ray to a source, return domega */ |
| 220 |
< |
RAY *sr, /* returned source ray */ |
| 221 |
< |
RAY *r, /* ray which hit object */ |
| 219 |
> |
srcray( /* aim a ray at a source, return domega */ |
| 220 |
> |
RAY *sr, /* prepared source ray */ |
| 221 |
> |
RAY *r, /* originating ray (or NULL) */ |
| 222 |
|
SRCINDEX *si /* source sample index */ |
| 223 |
|
) |
| 224 |
|
{ |
| 231 |
|
sr->rmax = 0.0; |
| 232 |
|
|
| 233 |
|
while ((d = nextssamp(sr, si)) != 0.0) { |
| 234 |
< |
sr->rsrc = si->sn; /* remember source */ |
| 234 |
> |
sr->rsrc = si->sn; /* remember source */ |
| 235 |
|
srcp = source + si->sn; |
| 236 |
|
if (srcp->sflags & SDISTANT) { |
| 237 |
|
if (srcp->sflags & SSPOT && spotout(sr, srcp->sl.s)) |
| 448 |
|
cntord[sn].brt = sintens(scp->coef); |
| 449 |
|
if (cntord[sn].brt <= 0.0) |
| 450 |
|
continue; |
| 454 |
– |
#ifdef SSKIPOPT |
| 455 |
– |
if (ssf_select != NULL && sskip_chk(ssf_select, scp->sno)) |
| 456 |
– |
scalescolor(scp->coef, r->scorr); |
| 457 |
– |
#endif |
| 451 |
|
VCOPY(scp->dir, sr.rdir); |
| 452 |
|
copyscolor(sr.rcoef, scp->coef); |
| 453 |
|
/* compute potential */ |
| 561 |
|
RAY *r |
| 562 |
|
) |
| 563 |
|
{ |
| 564 |
< |
int oldsampndx; |
| 564 |
> |
unsigned long oldsampndx; |
| 565 |
|
int nsamps; |
| 566 |
|
RAY sr; |
| 567 |
|
SRCINDEX si; |
| 583 |
|
nsamps = MAXSSAMP; |
| 584 |
|
#endif |
| 585 |
|
oldsampndx = samplendx; |
| 586 |
< |
samplendx = random()&0x7fff; /* randomize */ |
| 586 |
> |
samplendx = random()&0x7ffff; /* randomize */ |
| 587 |
|
for (i = volumePhotonMapping ? 1 : r->slights[0]; i > 0; i--) { |
| 588 |
|
/* for each source OR once if volume photon map enabled */ |
| 589 |
|
for (j = 0; j < nsamps; j++) { /* for each sample position */ |
| 603 |
|
sr.rorg[2] = r->rorg[2] + r->rdir[2]*t; |
| 604 |
|
|
| 605 |
|
if (!volumePhotonMapping) { |
| 606 |
< |
if (srcskip(r->slights[i], r)) |
| 606 |
> |
sr.parent = r; /* hack for preemptive test */ |
| 607 |
> |
if (srcskip(r->slights[i], &sr)) |
| 608 |
|
continue; |
| 609 |
|
initsrcindex(&si); /* sample ray to this source */ |
| 610 |
|
si.sn = r->slights[i]; |
| 636 |
|
} |
| 637 |
|
/* other factors */ |
| 638 |
|
d *= si.dom * r->rot / (4.*PI*nsamps); |
| 645 |
– |
#ifdef SSKIPOPT |
| 646 |
– |
if (ssf_select != NULL && sskip_chk(ssf_select, sr.rsrc)) |
| 647 |
– |
d *= r->scorr; |
| 648 |
– |
#endif |
| 639 |
|
scalescolor(sr.rcol, d); |
| 640 |
|
} else { |
| 641 |
|
/* PMAP: Add ambient inscattering from |