228 |
|
} else |
229 |
|
nd.tdiff = nd.tspec = nd.trans = 0.0; |
230 |
|
/* transmitted ray */ |
231 |
< |
if ((nd.specfl&(SP_TRAN|SP_PURE)) == (SP_TRAN|SP_PURE)) { |
231 |
> |
if (nd.specfl&SP_TRAN && (nd.specfl&SP_PURE || r->crtype&SHADOW)) { |
232 |
|
RAY lr; |
233 |
|
if (rayorigin(&lr, r, TRANS, nd.tspec) == 0) { |
234 |
|
VCOPY(lr.rdir, nd.prdir); |
290 |
|
gaussamp(r, &nd); |
291 |
|
|
292 |
|
if (nd.rdiff > FTINY) { /* ambient from this side */ |
293 |
< |
ambient(ctmp, r); |
293 |
> |
ambient(ctmp, r, hastexture?nd.pnorm:r->ron); |
294 |
|
if (nd.specfl & SP_RBLT) |
295 |
|
scalecolor(ctmp, 1.0-nd.trans); |
296 |
|
else |
300 |
|
} |
301 |
|
if (nd.tdiff > FTINY) { /* ambient from other side */ |
302 |
|
flipsurface(r); |
303 |
< |
ambient(ctmp, r); |
303 |
> |
if (hastexture) { |
304 |
> |
FVECT bnorm; |
305 |
> |
bnorm[0] = -nd.pnorm[0]; |
306 |
> |
bnorm[1] = -nd.pnorm[1]; |
307 |
> |
bnorm[2] = -nd.pnorm[2]; |
308 |
> |
ambient(ctmp, r, bnorm); |
309 |
> |
} else |
310 |
> |
ambient(ctmp, r, r->ron); |
311 |
|
if (nd.specfl & SP_TBLT) |
312 |
|
scalecolor(ctmp, nd.trans); |
313 |
|
else |