219 |
|
|
220 |
|
|
221 |
|
int |
222 |
< |
srcray( /* send a ray to a source, return domega */ |
223 |
< |
RAY *sr, /* returned source ray */ |
224 |
< |
RAY *r, /* ray which hit object */ |
222 |
> |
srcray( /* aim a ray at a source, return domega */ |
223 |
> |
RAY *sr, /* prepared source ray */ |
224 |
> |
RAY *r, /* originating ray (or NULL) */ |
225 |
|
SRCINDEX *si /* source sample index */ |
226 |
|
) |
227 |
|
{ |
234 |
|
sr->rmax = 0.0; |
235 |
|
|
236 |
|
while ((d = nextssamp(sr, si)) != 0.0) { |
237 |
< |
sr->rsrc = si->sn; /* remember source */ |
237 |
> |
sr->rsrc = si->sn; /* remember source */ |
238 |
|
srcp = source + si->sn; |
239 |
|
if (srcp->sflags & SDISTANT) { |
240 |
|
if (srcp->sflags & SSPOT && spotout(sr, srcp->sl.s)) |
610 |
|
sr.rorg[2] = r->rorg[2] + r->rdir[2]*t; |
611 |
|
|
612 |
|
if (!volumePhotonMapping) { |
613 |
< |
if (srcskip(r->slights[i], r)) |
613 |
> |
sr.parent = r; /* hack for preemptive test */ |
614 |
> |
if (srcskip(r->slights[i], &sr)) |
615 |
|
continue; |
616 |
|
initsrcindex(&si); /* sample ray to this source */ |
617 |
|
si.sn = r->slights[i]; |