156 |
|
psamp[i].tdir[1] = -ndp->vray[1] + dir2check[i][1]*srchrad; |
157 |
|
psamp[i].tdir[2] = -ndp->vray[2]; |
158 |
|
normalize(psamp[i].tdir); |
159 |
< |
ec = SDevalBSDF(&sv, psamp[i].tdir, ndp->vray, ndp->sd); |
159 |
> |
ec = SDevalBSDF(&sv, ndp->vray, psamp[i].tdir, ndp->sd); |
160 |
|
if (ec) |
161 |
|
goto baderror; |
162 |
|
cvt_sdcolor(psamp[i].vcol, &sv); |
173 |
|
if (i && psamp[i].vy == psamp[i-1].vy) |
174 |
|
continue; /* assume duplicate sample */ |
175 |
|
|
176 |
< |
ec = SDsizeBSDF(&tomega, psamp[i].tdir, ndp->vray, |
176 |
> |
ec = SDsizeBSDF(&tomega, ndp->vray, psamp[i].tdir, |
177 |
|
SDqueryMin, ndp->sd); |
178 |
|
if (ec) |
179 |
|
goto baderror; |
192 |
|
vypeak += psamp[i].vy; |
193 |
|
++ns; |
194 |
|
} |
195 |
< |
if (tomsurr <= FTINY) /* no surround implies no peak */ |
195 |
> |
if (tomsurr < 0.2*tomsum) /* insufficient surround? */ |
196 |
|
return; |
197 |
|
if ((vypeak/ns - (ndp->vray[2] > 0 ? ndp->sd->tLambFront.cieY |
198 |
|
: ndp->sd->tLambBack.cieY)*(1./PI))*tomsum < .0005) |