| 177 |
|
double d; /* distance to source */ |
| 178 |
|
register SRCREC *srcp; |
| 179 |
|
|
| 180 |
< |
rayorigin(sr, r, SHADOW, 1.0); /* ignore limits */ |
| 180 |
> |
rayorigin(sr, SHADOW, r, NULL); /* ignore limits */ |
| 181 |
|
|
| 182 |
|
while ((d = nextssamp(sr, si)) != 0.0) { |
| 183 |
|
sr->rsrc = si->sn; /* remember source */ |
| 393 |
|
} |
| 394 |
|
#endif |
| 395 |
|
VCOPY(scp->dir, sr.rdir); |
| 396 |
+ |
copycolor(sr.rcoef, scp->coef); |
| 397 |
|
/* compute potential */ |
| 398 |
< |
srcvalue(&sr); |
| 398 |
> |
sr.revf = srcvalue; |
| 399 |
> |
rayvalue(&sr); |
| 400 |
> |
multcolor(sr.rcol, sr.rcoef); |
| 401 |
|
copycolor(scp->val, sr.rcol); |
| 399 |
– |
multcolor(scp->val, scp->coef); |
| 402 |
|
cntord[sn].brt = bright(scp->val); |
| 403 |
|
} |
| 404 |
|
/* sort contributions */ |
| 437 |
|
break; |
| 438 |
|
scp = srccnt + cntord[sn].sndx; |
| 439 |
|
/* test for hit */ |
| 440 |
< |
rayorigin(&sr, r, SHADOW, 1.0); |
| 440 |
> |
rayorigin(&sr, SHADOW, r, scp->coef); |
| 441 |
|
VCOPY(sr.rdir, scp->dir); |
| 442 |
|
sr.rsrc = scp->sno; |
| 443 |
|
/* keep statistics */ |
| 450 |
|
source[scp->sno].sflags & SFOLLOW )) { |
| 451 |
|
/* follow entire path */ |
| 452 |
|
raycont(&sr); |
| 451 |
– |
rayparticipate(&sr); |
| 453 |
|
if (trace != NULL) |
| 454 |
|
(*trace)(&sr); /* trace execution */ |
| 455 |
+ |
rayparticipate(&sr); |
| 456 |
|
if (bright(sr.rcol) <= FTINY) { |
| 457 |
|
#if SHADCACHE |
| 458 |
|
if ((scp <= srccnt || scp[-1].sno != scp->sno) |
| 462 |
|
#endif |
| 463 |
|
continue; /* missed! */ |
| 464 |
|
} |
| 465 |
+ |
multcolor(sr.rcol, sr.rcoef); |
| 466 |
|
copycolor(scp->val, sr.rcol); |
| 467 |
< |
multcolor(scp->val, scp->coef); |
| 467 |
> |
} else if (trace != NULL && |
| 468 |
> |
(source[scp->sno].sflags & (SDISTANT|SVIRTUAL|SFOLLOW)) |
| 469 |
> |
== (SDISTANT|SFOLLOW) && |
| 470 |
> |
sourcehit(&sr) && rayshade(&sr, sr.ro->omod)) { |
| 471 |
> |
(*trace)(&sr); /* trace execution */ |
| 472 |
> |
/* skip call to rayparticipate() & scp->val update */ |
| 473 |
|
} |
| 474 |
|
/* add contribution if hit */ |
| 475 |
|
addcolor(r->rcol, scp->val); |
| 491 |
|
scp = srccnt + cntord[sn].sndx; |
| 492 |
|
prob = hwt * (double)source[scp->sno].nhits / |
| 493 |
|
(double)source[scp->sno].ntests; |
| 494 |
< |
if (prob > 1.0) |
| 495 |
< |
prob = 1.0; |
| 488 |
< |
scalecolor(scp->val, prob); |
| 494 |
> |
if (prob < 1.0) |
| 495 |
> |
scalecolor(scp->val, prob); |
| 496 |
|
addcolor(r->rcol, scp->val); |
| 497 |
|
} |
| 498 |
|
} |
| 671 |
|
) |
| 672 |
|
{ |
| 673 |
|
/* check for over-counting */ |
| 674 |
< |
if (badcomponent(m, r)) |
| 674 |
> |
if (badcomponent(m, r)) { |
| 675 |
> |
setcolor(r->rcoef, 0.0, 0.0, 0.0); |
| 676 |
|
return(1); |
| 677 |
< |
if (wrongsource(m, r)) |
| 677 |
> |
} |
| 678 |
> |
if (wrongsource(m, r)) { |
| 679 |
> |
setcolor(r->rcoef, 0.0, 0.0, 0.0); |
| 680 |
|
return(1); |
| 681 |
+ |
} |
| 682 |
|
/* check for passed illum */ |
| 683 |
|
if (passillum(m, r)) { |
| 684 |
|
if (m->oargs.nsargs && strcmp(m->oargs.sarg[0], VOIDID)) |
| 686 |
|
raytrans(r); |
| 687 |
|
return(1); |
| 688 |
|
} |
| 689 |
+ |
/* check for invisibility */ |
| 690 |
+ |
if (srcignore(m, r)) { |
| 691 |
+ |
setcolor(r->rcoef, 0.0, 0.0, 0.0); |
| 692 |
+ |
return(1); |
| 693 |
+ |
} |
| 694 |
|
/* otherwise treat as source */ |
| 695 |
|
/* check for behind */ |
| 696 |
|
if (r->rod < 0.0) |
| 681 |
– |
return(1); |
| 682 |
– |
/* check for invisibility */ |
| 683 |
– |
if (srcignore(m, r)) |
| 697 |
|
return(1); |
| 698 |
|
/* check for outside spot */ |
| 699 |
|
if (m->otype==MAT_SPOT && spotout(r, makespot(m))) |