598 |
|
sd->name); |
599 |
|
return SDEsupport; |
600 |
|
} |
601 |
< |
/* get angle basis */ |
602 |
< |
rval = load_angle_basis(ezxml_child(ezxml_child(wtl, |
603 |
< |
"DataDefinition"), "AngleBasis")); |
604 |
< |
if (rval < 0) |
605 |
< |
return convert_errcode(rval); |
601 |
> |
/* get angle bases */ |
602 |
> |
for (wld = ezxml_child(ezxml_child(wtl, "DataDefinition"), "AngleBasis"); |
603 |
> |
wld != NULL; wld = wld->next) { |
604 |
> |
rval = load_angle_basis(wld); |
605 |
> |
if (rval < 0) |
606 |
> |
return convert_errcode(rval); |
607 |
> |
} |
608 |
|
/* load BSDF components */ |
609 |
|
for (wld = ezxml_child(wtl, "WavelengthData"); |
610 |
|
wld != NULL; wld = wld->next) { |
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)) { |
642 |
> |
if ((i_ndx < 0) & (o_ndx < 0) && dp->ninc == dp->nout) { |
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 { /* try reciprocity */ |
751 |
> |
} else if (dp->ninc == dp->nout) { /* try reciprocity */ |
752 |
|
myCD.indx = mBSDF_outndx(dp, inVec); |
753 |
|
if (myCD.indx < 0) |
754 |
|
return NULL; |
798 |
|
/* binary search to find index */ |
799 |
|
ilower = 0; iupper = mcd->calen; |
800 |
|
while ((i = (iupper + ilower) >> 1) != ilower) |
801 |
< |
if ((long)target >= (long)mcd->carr[i]) |
801 |
> |
if (target >= mcd->carr[i]) |
802 |
|
ilower = i; |
803 |
|
else |
804 |
|
iupper = i; |