| 55 |
|
ao = objptr(aobj); |
| 56 |
|
if (ismaterial(ao->otype)) |
| 57 |
|
return(ao); |
| 58 |
+ |
if (ao->otype == MOD_ALIAS) { |
| 59 |
+ |
o = ao; |
| 60 |
+ |
continue; |
| 61 |
+ |
} |
| 62 |
|
} |
| 63 |
|
if (o->omod == OVOID) |
| 64 |
|
return(NULL); |
| 86 |
|
continue; |
| 87 |
|
/* find material */ |
| 88 |
|
m = findmaterial(objptr(o->omod)); |
| 89 |
< |
if (m == NULL || !islight(m->otype)) |
| 89 |
> |
if (m == NULL) |
| 90 |
> |
continue; |
| 91 |
> |
if (m->otype == MAT_CLIP) { |
| 92 |
> |
markclip(m); /* special case for antimatter */ |
| 93 |
> |
continue; |
| 94 |
> |
} |
| 95 |
> |
if (!islight(m->otype)) |
| 96 |
|
continue; /* not source modifier */ |
| 97 |
|
|
| 98 |
|
if (m->oargs.nfargs != (m->otype == MAT_GLOW ? 4 : |
| 187 |
|
double d; /* distance to source */ |
| 188 |
|
register SRCREC *srcp; |
| 189 |
|
|
| 190 |
< |
rayorigin(sr, r, SHADOW, 1.0); /* ignore limits */ |
| 190 |
> |
rayorigin(sr, SHADOW, r, NULL); /* ignore limits */ |
| 191 |
|
|
| 192 |
|
while ((d = nextssamp(sr, si)) != 0.0) { |
| 193 |
|
sr->rsrc = si->sn; /* remember source */ |
| 392 |
|
scp->sno = sr.rsrc; |
| 393 |
|
/* compute coefficient */ |
| 394 |
|
(*f)(scp->coef, p, sr.rdir, si.dom); |
| 395 |
< |
cntord[sn].brt = bright(scp->coef); |
| 395 |
> |
cntord[sn].brt = intens(scp->coef); |
| 396 |
|
if (cntord[sn].brt <= 0.0) |
| 397 |
|
continue; |
| 398 |
|
#if SHADCACHE |
| 403 |
|
} |
| 404 |
|
#endif |
| 405 |
|
VCOPY(scp->dir, sr.rdir); |
| 406 |
+ |
copycolor(sr.rcoef, scp->coef); |
| 407 |
|
/* compute potential */ |
| 408 |
< |
srcvalue(&sr); |
| 408 |
> |
sr.revf = srcvalue; |
| 409 |
> |
rayvalue(&sr); |
| 410 |
> |
multcolor(sr.rcol, sr.rcoef); |
| 411 |
|
copycolor(scp->val, sr.rcol); |
| 412 |
< |
multcolor(scp->val, scp->coef); |
| 400 |
< |
cntord[sn].brt = bright(scp->val); |
| 412 |
> |
cntord[sn].brt = intens(sr.rcol); |
| 413 |
|
} |
| 414 |
|
/* sort contributions */ |
| 415 |
|
qsort(cntord, sn, sizeof(CNTPTR), cntcmp); |
| 447 |
|
break; |
| 448 |
|
scp = srccnt + cntord[sn].sndx; |
| 449 |
|
/* test for hit */ |
| 450 |
< |
rayorigin(&sr, r, SHADOW, 1.0); |
| 450 |
> |
rayorigin(&sr, SHADOW, r, NULL); |
| 451 |
> |
copycolor(sr.rcoef, scp->coef); |
| 452 |
|
VCOPY(sr.rdir, scp->dir); |
| 453 |
|
sr.rsrc = scp->sno; |
| 454 |
|
/* keep statistics */ |
| 461 |
|
source[scp->sno].sflags & SFOLLOW )) { |
| 462 |
|
/* follow entire path */ |
| 463 |
|
raycont(&sr); |
| 451 |
– |
rayparticipate(&sr); |
| 464 |
|
if (trace != NULL) |
| 465 |
|
(*trace)(&sr); /* trace execution */ |
| 466 |
|
if (bright(sr.rcol) <= FTINY) { |
| 472 |
|
#endif |
| 473 |
|
continue; /* missed! */ |
| 474 |
|
} |
| 475 |
+ |
rayparticipate(&sr); |
| 476 |
+ |
multcolor(sr.rcol, sr.rcoef); |
| 477 |
|
copycolor(scp->val, sr.rcol); |
| 478 |
< |
multcolor(scp->val, scp->coef); |
| 478 |
> |
} else if (trace != NULL && |
| 479 |
> |
(source[scp->sno].sflags & (SDISTANT|SVIRTUAL|SFOLLOW)) |
| 480 |
> |
== (SDISTANT|SFOLLOW) && |
| 481 |
> |
sourcehit(&sr) && rayshade(&sr, sr.ro->omod)) { |
| 482 |
> |
(*trace)(&sr); /* trace execution */ |
| 483 |
> |
/* skip call to rayparticipate() & scp->val update */ |
| 484 |
|
} |
| 485 |
|
/* add contribution if hit */ |
| 486 |
|
addcolor(r->rcol, scp->val); |
| 502 |
|
scp = srccnt + cntord[sn].sndx; |
| 503 |
|
prob = hwt * (double)source[scp->sno].nhits / |
| 504 |
|
(double)source[scp->sno].ntests; |
| 505 |
< |
if (prob > 1.0) |
| 506 |
< |
prob = 1.0; |
| 488 |
< |
scalecolor(scp->val, prob); |
| 505 |
> |
if (prob < 1.0) |
| 506 |
> |
scalecolor(scp->val, prob); |
| 507 |
|
addcolor(r->rcol, scp->val); |
| 508 |
|
} |
| 509 |
|
} |
| 682 |
|
) |
| 683 |
|
{ |
| 684 |
|
/* check for over-counting */ |
| 685 |
< |
if (badcomponent(m, r)) |
| 685 |
> |
if (badcomponent(m, r)) { |
| 686 |
> |
setcolor(r->rcoef, 0.0, 0.0, 0.0); |
| 687 |
|
return(1); |
| 688 |
< |
if (wrongsource(m, r)) |
| 688 |
> |
} |
| 689 |
> |
if (wrongsource(m, r)) { |
| 690 |
> |
setcolor(r->rcoef, 0.0, 0.0, 0.0); |
| 691 |
|
return(1); |
| 692 |
+ |
} |
| 693 |
|
/* check for passed illum */ |
| 694 |
|
if (passillum(m, r)) { |
| 695 |
|
if (m->oargs.nsargs && strcmp(m->oargs.sarg[0], VOIDID)) |
| 697 |
|
raytrans(r); |
| 698 |
|
return(1); |
| 699 |
|
} |
| 700 |
+ |
/* check for invisibility */ |
| 701 |
+ |
if (srcignore(m, r)) { |
| 702 |
+ |
setcolor(r->rcoef, 0.0, 0.0, 0.0); |
| 703 |
+ |
return(1); |
| 704 |
+ |
} |
| 705 |
|
/* otherwise treat as source */ |
| 706 |
|
/* check for behind */ |
| 707 |
|
if (r->rod < 0.0) |
| 681 |
– |
return(1); |
| 682 |
– |
/* check for invisibility */ |
| 683 |
– |
if (srcignore(m, r)) |
| 708 |
|
return(1); |
| 709 |
|
/* check for outside spot */ |
| 710 |
|
if (m->otype==MAT_SPOT && spotout(r, makespot(m))) |