634 |
|
/* get BSDF data */ |
635 |
|
nd.sd = loadBSDF(m->oargs.sarg[hasthick]); |
636 |
|
/* early shadow check #2 */ |
637 |
< |
if (r->crtype & SHADOW && (nd.sd->tf == NULL) & (nd.sd->tb == NULL)) |
637 |
> |
if (r->crtype & SHADOW && (nd.sd->tf == NULL) & (nd.sd->tb == NULL)) { |
638 |
> |
SDfreeCache(nd.sd); |
639 |
|
return(1); |
640 |
+ |
} |
641 |
|
/* diffuse reflectance */ |
642 |
|
if (hitfront) { |
643 |
|
cvt_sdcolor(nd.rdiff, &nd.sd->rLambFront); |
693 |
|
} |
694 |
|
if (ec) { |
695 |
|
objerror(m, WARNING, "Illegal orientation vector"); |
696 |
+ |
SDfreeCache(nd.sd); |
697 |
|
return(1); |
698 |
|
} |
699 |
|
setcolor(nd.cthru, 0, 0, 0); /* consider through component */ |
701 |
|
compute_through(&nd); |
702 |
|
if (r->crtype & SHADOW) { |
703 |
|
RAY tr; /* attempt to pass shadow ray */ |
704 |
+ |
SDfreeCache(nd.sd); |
705 |
|
if (rayorigin(&tr, TRANS, r, nd.cthru) < 0) |
706 |
|
return(1); /* no through component */ |
707 |
|
VCOPY(tr.rdir, r->rdir); |