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); |
181 |
|
double d; /* distance to source */ |
182 |
|
register SRCREC *srcp; |
183 |
|
|
184 |
< |
rayorigin(sr, r, SHADOW, 1.0); /* ignore limits */ |
184 |
> |
rayorigin(sr, SHADOW, r, NULL); /* ignore limits */ |
185 |
|
|
186 |
|
while ((d = nextssamp(sr, si)) != 0.0) { |
187 |
|
sr->rsrc = si->sn; /* remember source */ |
386 |
|
scp->sno = sr.rsrc; |
387 |
|
/* compute coefficient */ |
388 |
|
(*f)(scp->coef, p, sr.rdir, si.dom); |
389 |
< |
cntord[sn].brt = bright(scp->coef); |
389 |
> |
cntord[sn].brt = intens(scp->coef); |
390 |
|
if (cntord[sn].brt <= 0.0) |
391 |
|
continue; |
392 |
|
#if SHADCACHE |
397 |
|
} |
398 |
|
#endif |
399 |
|
VCOPY(scp->dir, sr.rdir); |
400 |
+ |
copycolor(sr.rcoef, scp->coef); |
401 |
|
/* compute potential */ |
402 |
|
sr.revf = srcvalue; |
403 |
|
rayvalue(&sr); |
404 |
+ |
multcolor(sr.rcol, sr.rcoef); |
405 |
|
copycolor(scp->val, sr.rcol); |
406 |
< |
multcolor(scp->val, scp->coef); |
401 |
< |
cntord[sn].brt = bright(scp->val); |
406 |
> |
cntord[sn].brt = intens(sr.rcol); |
407 |
|
} |
408 |
|
/* sort contributions */ |
409 |
|
qsort(cntord, sn, sizeof(CNTPTR), cntcmp); |
441 |
|
break; |
442 |
|
scp = srccnt + cntord[sn].sndx; |
443 |
|
/* test for hit */ |
444 |
< |
rayorigin(&sr, r, SHADOW, 1.0); |
444 |
> |
rayorigin(&sr, SHADOW, r, NULL); |
445 |
> |
copycolor(sr.rcoef, scp->coef); |
446 |
|
VCOPY(sr.rdir, scp->dir); |
447 |
|
sr.rsrc = scp->sno; |
448 |
|
/* keep statistics */ |
455 |
|
source[scp->sno].sflags & SFOLLOW )) { |
456 |
|
/* follow entire path */ |
457 |
|
raycont(&sr); |
452 |
– |
rayparticipate(&sr); |
458 |
|
if (trace != NULL) |
459 |
|
(*trace)(&sr); /* trace execution */ |
460 |
|
if (bright(sr.rcol) <= FTINY) { |
466 |
|
#endif |
467 |
|
continue; /* missed! */ |
468 |
|
} |
469 |
+ |
rayparticipate(&sr); |
470 |
+ |
multcolor(sr.rcol, sr.rcoef); |
471 |
|
copycolor(scp->val, sr.rcol); |
472 |
< |
multcolor(scp->val, scp->coef); |
472 |
> |
} else if (trace != NULL && |
473 |
> |
(source[scp->sno].sflags & (SDISTANT|SVIRTUAL|SFOLLOW)) |
474 |
> |
== (SDISTANT|SFOLLOW) && |
475 |
> |
sourcehit(&sr) && rayshade(&sr, sr.ro->omod)) { |
476 |
> |
(*trace)(&sr); /* trace execution */ |
477 |
> |
/* skip call to rayparticipate() & scp->val update */ |
478 |
|
} |
479 |
|
/* add contribution if hit */ |
480 |
|
addcolor(r->rcol, scp->val); |
496 |
|
scp = srccnt + cntord[sn].sndx; |
497 |
|
prob = hwt * (double)source[scp->sno].nhits / |
498 |
|
(double)source[scp->sno].ntests; |
499 |
< |
if (prob > 1.0) |
500 |
< |
prob = 1.0; |
489 |
< |
scalecolor(scp->val, prob); |
499 |
> |
if (prob < 1.0) |
500 |
> |
scalecolor(scp->val, prob); |
501 |
|
addcolor(r->rcol, scp->val); |
502 |
|
} |
503 |
|
} |
676 |
|
) |
677 |
|
{ |
678 |
|
/* check for over-counting */ |
679 |
< |
if (badcomponent(m, r)) |
679 |
> |
if (badcomponent(m, r)) { |
680 |
> |
setcolor(r->rcoef, 0.0, 0.0, 0.0); |
681 |
|
return(1); |
682 |
< |
if (wrongsource(m, r)) |
682 |
> |
} |
683 |
> |
if (wrongsource(m, r)) { |
684 |
> |
setcolor(r->rcoef, 0.0, 0.0, 0.0); |
685 |
|
return(1); |
686 |
+ |
} |
687 |
|
/* check for passed illum */ |
688 |
|
if (passillum(m, r)) { |
689 |
|
if (m->oargs.nsargs && strcmp(m->oargs.sarg[0], VOIDID)) |
691 |
|
raytrans(r); |
692 |
|
return(1); |
693 |
|
} |
694 |
+ |
/* check for invisibility */ |
695 |
+ |
if (srcignore(m, r)) { |
696 |
+ |
setcolor(r->rcoef, 0.0, 0.0, 0.0); |
697 |
+ |
return(1); |
698 |
+ |
} |
699 |
|
/* otherwise treat as source */ |
700 |
|
/* check for behind */ |
701 |
|
if (r->rod < 0.0) |
682 |
– |
return(1); |
683 |
– |
/* check for invisibility */ |
684 |
– |
if (srcignore(m, r)) |
702 |
|
return(1); |
703 |
|
/* check for outside spot */ |
704 |
|
if (m->otype==MAT_SPOT && spotout(r, makespot(m))) |