| 284 |
|
unsigned skipmask = 0; |
| 285 |
|
csiz *= .5; |
| 286 |
|
for (i = st->ndim; i--; ) |
| 287 |
< |
if (1<<i & cmask) |
| 287 |
> |
if (1<<i & cmask) { |
| 288 |
|
if (pos[i] < cmin[i] + csiz) |
| 289 |
|
for (n = 1 << st->ndim; n--; ) { |
| 290 |
|
if (n & 1<<i) |
| 295 |
|
if (!(n & 1<<i)) |
| 296 |
|
skipmask |= 1<<n; |
| 297 |
|
} |
| 298 |
+ |
} |
| 299 |
|
for (n = 1 << st->ndim; n--; ) { |
| 300 |
|
if (1<<n & skipmask) |
| 301 |
|
continue; |
| 469 |
|
/* convert vector coordinates */ |
| 470 |
|
if (sdt->st->ndim == 3) { |
| 471 |
|
spinvector(rOutVec, outVec, zvec, -atan2(-inVec[1],-inVec[0])); |
| 472 |
< |
gridPos[0] = .5 - .5*sqrt(inVec[0]*inVec[0] + inVec[1]*inVec[1]); |
| 472 |
> |
gridPos[0] = (.5-FTINY) - |
| 473 |
> |
.5*sqrt(inVec[0]*inVec[0] + inVec[1]*inVec[1]); |
| 474 |
|
SDdisk2square(gridPos+1, rOutVec[0], rOutVec[1]); |
| 475 |
|
} else if (sdt->st->ndim == 4) { |
| 476 |
|
SDdisk2square(gridPos, -inVec[0], -inVec[1]); |
| 674 |
|
if (sdt->st->ndim == 3) { /* isotropic BSDF? */ |
| 675 |
|
if (mode != sdt->sidef) /* XXX unhandled reciprocity */ |
| 676 |
|
return &SDemptyCD; |
| 677 |
< |
inCoord[0] = .5 - .5*sqrt(inVec[0]*inVec[0] + inVec[1]*inVec[1]); |
| 677 |
> |
inCoord[0] = (.5-FTINY) - |
| 678 |
> |
.5*sqrt(inVec[0]*inVec[0] + inVec[1]*inVec[1]); |
| 679 |
|
} else if (sdt->st->ndim == 4) { |
| 680 |
|
if (mode != sdt->sidef) /* use reciprocity? */ |
| 681 |
|
SDdisk2square(inCoord, inVec[0], inVec[1]); |
| 731 |
|
} else { |
| 732 |
|
const SDTreCDst *cd = (const SDTreCDst *)SDgetTreCDist(v1, sdc); |
| 733 |
|
if (cd == NULL) |
| 734 |
< |
return SDEmemory; |
| 735 |
< |
myPSA[0] = M_PI * (cd->clim[0][1] - cd->clim[0][0]) * |
| 736 |
< |
(cd->clim[1][1] - cd->clim[1][0]); |
| 737 |
< |
myPSA[1] = cd->max_psa; |
| 734 |
> |
myPSA[0] = myPSA[1] = 0; |
| 735 |
> |
else { |
| 736 |
> |
myPSA[0] = M_PI * (cd->clim[0][1] - cd->clim[0][0]) * |
| 737 |
> |
(cd->clim[1][1] - cd->clim[1][0]); |
| 738 |
> |
myPSA[1] = cd->max_psa; |
| 739 |
> |
} |
| 740 |
|
} |
| 741 |
|
switch (qflags) { /* record based on flag settings */ |
| 742 |
|
case SDqueryVal: |
| 751 |
|
psa[1] = myPSA[1]; |
| 752 |
|
/* fall through */ |
| 753 |
|
case SDqueryMin: |
| 754 |
< |
if (myPSA[0] < psa[0]) |
| 754 |
> |
if ((myPSA[0] > 0) & (myPSA[0] < psa[0])) |
| 755 |
|
psa[0] = myPSA[0]; |
| 756 |
|
break; |
| 757 |
|
} |
| 800 |
|
SDsquare2disk(gpos, gpos[0], gpos[1]); |
| 801 |
|
/* compute Z-coordinate */ |
| 802 |
|
gpos[2] = 1. - gpos[0]*gpos[0] - gpos[1]*gpos[1]; |
| 803 |
< |
if (gpos[2] > 0) /* paranoia, I hope */ |
| 799 |
< |
gpos[2] = sqrt(gpos[2]); |
| 803 |
> |
gpos[2] = sqrt(gpos[2]*(gpos[2]>0)); |
| 804 |
|
/* emit from back? */ |
| 805 |
|
if ((cd->sidef == SD_BREFL) | (cd->sidef == SD_FXMIT)) |
| 806 |
|
gpos[2] = -gpos[2]; |
| 1167 |
|
/* separate diffuse components */ |
| 1168 |
|
extract_diffuse(&sd->rLambFront, sd->rf); |
| 1169 |
|
extract_diffuse(&sd->rLambBack, sd->rb); |
| 1170 |
< |
extract_diffuse(&sd->tLamb, (sd->tf != NULL) ? sd->tf : sd->tb); |
| 1170 |
> |
if (sd->tf != NULL) |
| 1171 |
> |
extract_diffuse(&sd->tLamb, sd->tf); |
| 1172 |
> |
if (sd->tb != NULL) |
| 1173 |
> |
extract_diffuse(&sd->tLamb, sd->tb); |
| 1174 |
|
/* return success */ |
| 1175 |
|
return SDEnone; |
| 1176 |
|
} |