| 488 |
|
return SDEargument; |
| 489 |
|
/* get cumulative distribution */ |
| 490 |
|
VCOPY(inVec, ioVec); |
| 491 |
+ |
sv->cieY = 0; |
| 492 |
|
cd = (*sdc->func->getCDist)(inVec, sdc); |
| 493 |
< |
if (cd == NULL) |
| 494 |
< |
return SDEmemory; |
| 495 |
< |
if (cd->cTotal <= 1e-6) { /* anything to sample? */ |
| 493 |
> |
if (cd != NULL) |
| 494 |
> |
sv->cieY = cd->cTotal; |
| 495 |
> |
if (sv->cieY <= 1e-6) { /* nothing to sample? */ |
| 496 |
|
sv->spec = c_dfcolor; |
| 496 |
– |
sv->cieY = .0; |
| 497 |
|
memset(ioVec, 0, 3*sizeof(double)); |
| 498 |
|
return SDEnone; |
| 499 |
|
} |
| 500 |
– |
sv->cieY = cd->cTotal; |
| 500 |
|
/* compute sample direction */ |
| 501 |
|
ec = (*sdc->func->sampCDist)(ioVec, randX, cd); |
| 502 |
|
if (ec) |
| 755 |
|
return SDEmemory; |
| 756 |
|
while (j-- > 0) { /* non-diffuse transmission */ |
| 757 |
|
cdarr[i+j] = (*tdf->comp[j].func->getCDist)(inVec, &tdf->comp[j]); |
| 758 |
< |
if (cdarr[i+j] == NULL) { |
| 759 |
< |
free(cdarr); |
| 761 |
< |
return SDEmemory; |
| 762 |
< |
} |
| 758 |
> |
if (cdarr[i+j] == NULL) |
| 759 |
> |
cdarr[i+j] = &SDemptyCD; |
| 760 |
|
sv->cieY += cdarr[i+j]->cTotal; |
| 761 |
|
} |
| 762 |
|
while (i-- > 0) { /* non-diffuse reflection */ |
| 763 |
|
cdarr[i] = (*rdf->comp[i].func->getCDist)(inVec, &rdf->comp[i]); |
| 764 |
< |
if (cdarr[i] == NULL) { |
| 765 |
< |
free(cdarr); |
| 766 |
< |
return SDEmemory; |
| 767 |
< |
} |
| 771 |
< |
sv->cieY += cdarr[i]->cTotal; |
| 764 |
> |
if (cdarr[i] == NULL) |
| 765 |
> |
cdarr[i] = &SDemptyCD; |
| 766 |
> |
else |
| 767 |
> |
sv->cieY += cdarr[i]->cTotal; |
| 768 |
|
} |
| 769 |
|
if (sv->cieY <= 1e-6) { /* anything to sample? */ |
| 770 |
|
sv->cieY = .0; |