199 |
|
} |
200 |
|
wtl = ezxml_child(ezxml_child(fl, "Optical"), "Layer"); |
201 |
|
if (wtl == NULL) { |
202 |
< |
sprintf(SDerrorDetail, "BSDF \"%s\": no optical layers'", |
202 |
> |
sprintf(SDerrorDetail, "BSDF \"%s\": no optical layers", |
203 |
|
sd->name); |
204 |
|
ezxml_free(fl); |
205 |
|
return SDEformat; |
558 |
|
SDmultiSamp(outVec, 2, randX); |
559 |
|
SDsquare2disk(outVec, outVec[0], outVec[1]); |
560 |
|
outVec[2] = 1. - outVec[0]*outVec[0] - outVec[1]*outVec[1]; |
561 |
< |
if (outVec[2] > 0) /* a bit of paranoia */ |
562 |
< |
outVec[2] = sqrt(outVec[2]); |
561 |
> |
outVec[2] = sqrt(outVec[2]*(outVec[2]>0)); |
562 |
|
if (!outFront) /* going out back? */ |
563 |
|
outVec[2] = -outVec[2]; |
564 |
|
} |
763 |
|
cdarr[i] = (*rdf->comp[i].func->getCDist)(inVec, &rdf->comp[i]); |
764 |
|
if (cdarr[i] == NULL) |
765 |
|
cdarr[i] = &SDemptyCD; |
766 |
< |
else |
768 |
< |
sv->cieY += cdarr[i]->cTotal; |
766 |
> |
sv->cieY += cdarr[i]->cTotal; |
767 |
|
} |
768 |
|
if (sv->cieY <= 1e-6) { /* anything to sample? */ |
769 |
|
sv->cieY = .0; |
788 |
|
randX -= sd->tLamb.cieY; |
789 |
|
} |
790 |
|
/* else one of cumulative dist. */ |
791 |
< |
for (i = 0; i < n && randX < cdarr[i]->cTotal; i++) |
791 |
> |
for (i = 0; i < n && randX > cdarr[i]->cTotal; i++) |
792 |
|
randX -= cdarr[i]->cTotal; |
793 |
|
if (i >= n) |
794 |
|
return SDEinternal; |