639 |
|
i_ndx = mBSDF_incndx(dp, inVec); |
640 |
|
o_ndx = mBSDF_outndx(dp, outVec); |
641 |
|
/* try reciprocity if necessary */ |
642 |
< |
if ((i_ndx < 0) & (o_ndx < 0) && dp->ninc == dp->nout) { |
642 |
> |
if ((i_ndx < 0) & (o_ndx < 0)) { |
643 |
|
i_ndx = mBSDF_incndx(dp, outVec); |
644 |
|
o_ndx = mBSDF_outndx(dp, inVec); |
645 |
|
} |
748 |
|
myCD.ob_vec = dp->ob_vec; |
749 |
|
myCD.calen = dp->nout; |
750 |
|
reverse = 0; |
751 |
< |
} else if (dp->ninc == dp->nout) { /* try reciprocity */ |
751 |
> |
} else { /* try reciprocity */ |
752 |
|
myCD.indx = mBSDF_outndx(dp, inVec); |
753 |
|
if (myCD.indx < 0) |
754 |
|
return NULL; |
759 |
|
} |
760 |
|
cdlast = NULL; /* check for it in cache list */ |
761 |
|
for (cd = (SDMatCDst *)sdc->cdList; cd != NULL; |
762 |
< |
cdlast = cd, cd = (SDMatCDst *)cd->next) |
762 |
> |
cdlast = cd, cd = cd->next) |
763 |
|
if (cd->indx == myCD.indx && (cd->calen == myCD.calen) & |
764 |
|
(cd->ob_priv == myCD.ob_priv) & |
765 |
|
(cd->ob_vec == myCD.ob_vec)) |
778 |
|
} |
779 |
|
if (cdlast != NULL) { /* move entry to head of cache list */ |
780 |
|
cdlast->next = cd->next; |
781 |
< |
cd->next = sdc->cdList; |
781 |
> |
cd->next = (SDMatCDst *)sdc->cdList; |
782 |
|
sdc->cdList = (SDCDst *)cd; |
783 |
|
} |
784 |
|
return (SDCDst *)cd; /* ready to go */ |