128 |
|
srchrad = sqrt(dfp->minProjSA); /* else search for peak */ |
129 |
|
setcolor(vpeak, 0, 0, 0); |
130 |
|
setcolor(vsum, 0, 0, 0); |
131 |
+ |
pdir[2] = 0.0; |
132 |
|
for (i = 0; i < NDIR2CHECK; i++) { |
133 |
|
FVECT tdir; |
134 |
|
SDValue sv; |
147 |
|
VCOPY(pdir, tdir); |
148 |
|
} |
149 |
|
} |
150 |
+ |
if (pdir[2] == 0.0) |
151 |
+ |
return; /* zero neighborhood */ |
152 |
|
ec = SDsizeBSDF(&tomega, pdir, ndp->vray, SDqueryMin, ndp->sd); |
153 |
|
if (ec) |
154 |
|
goto baderror; |
434 |
|
static int |
435 |
|
sample_sdcomp(BSDFDAT *ndp, SDComponent *dcp, int xmit) |
436 |
|
{ |
437 |
< |
int hasthru = (xmit && !(ndp->pr->crtype & (SPECULAR|AMBIENT)) |
438 |
< |
&& bright(ndp->cthru) > FTINY); |
439 |
< |
int nstarget = 1; |
440 |
< |
int nsent = 0; |
441 |
< |
int n; |
442 |
< |
SDError ec; |
443 |
< |
SDValue bsv; |
444 |
< |
double xrand; |
445 |
< |
FVECT vsmp, vinc; |
446 |
< |
RAY sr; |
437 |
> |
const int hasthru = (xmit && |
438 |
> |
!(ndp->pr->crtype & (SPECULAR|AMBIENT)) && |
439 |
> |
bright(ndp->cthru) > FTINY); |
440 |
> |
int nstarget = 1; |
441 |
> |
int nsent = 0; |
442 |
> |
int n; |
443 |
> |
SDError ec; |
444 |
> |
SDValue bsv; |
445 |
> |
double xrand; |
446 |
> |
FVECT vsmp, vinc; |
447 |
> |
RAY sr; |
448 |
|
/* multiple samples? */ |
449 |
|
if (specjitter > 1.5) { |
450 |
|
nstarget = specjitter*ndp->pr->rweight + .5; |
526 |
|
if (dfp == NULL) /* no specular component? */ |
527 |
|
return(0); |
528 |
|
|
525 |
– |
dimlist[ndims++] = (int)(size_t)ndp->mp; |
529 |
|
if (hasthru) { /* separate view sample? */ |
530 |
|
RAY tr; |
531 |
|
if (rayorigin(&tr, TRANS, ndp->pr, ndp->cthru) == 0) { |
538 |
|
} else |
539 |
|
hasthru = 0; |
540 |
|
} |
538 |
– |
ndims--; |
541 |
|
if (dfp->maxHemi - b <= FTINY) { /* how specular to sample? */ |
542 |
|
b = 0; |
543 |
|
} else { |
556 |
|
} |
557 |
|
return(ntotal); |
558 |
|
} |
559 |
< |
ndims += 2; /* else sample specular */ |
559 |
> |
dimlist[ndims] = (int)(size_t)ndp->mp; /* else sample specular */ |
560 |
> |
ndims += 2; |
561 |
|
for (n = dfp->ncomp; n--; ) { /* loop over components */ |
562 |
|
dimlist[ndims-1] = n + 9438; |
563 |
|
ntotal += sample_sdcomp(ndp, &dfp->comp[n], sflags==SDsampSpT); |