121 |
|
/* worth using? */ |
122 |
|
if (dtmp > FTINY) { |
123 |
|
copycolor(ctmp, np->scolor); |
124 |
< |
dtmp *= omega / np->pdot; |
124 |
> |
dtmp *= omega * sqrt(ldot/np->pdot); |
125 |
|
scalecolor(ctmp, dtmp); |
126 |
|
addcolor(cval, ctmp); |
127 |
|
} |
146 |
|
/* worth using? */ |
147 |
|
if (dtmp > FTINY) { |
148 |
|
copycolor(ctmp, np->mcolor); |
149 |
< |
dtmp *= np->tspec * omega / np->pdot; |
149 |
> |
dtmp *= np->tspec * omega * sqrt(ldot/np->pdot); |
150 |
|
scalecolor(ctmp, dtmp); |
151 |
|
addcolor(cval, ctmp); |
152 |
|
} |
205 |
|
nd.rspec += (1.0-nd.rspec)*dtmp; |
206 |
|
/* check threshold */ |
207 |
|
if (specthresh > FTINY && |
208 |
< |
((specthresh >= 1.-FTINY || |
209 |
< |
specthresh + (.05 - .1*frandom()) > nd.rspec))) |
208 |
> |
(specthresh >= 1.-FTINY || |
209 |
> |
specthresh + .05 - .1*frandom() > nd.rspec)) |
210 |
|
nd.specfl |= SP_RBLT; |
211 |
|
/* compute refl. direction */ |
212 |
|
for (i = 0; i < 3; i++) |
224 |
|
nd.specfl |= SP_TRAN; |
225 |
|
/* check threshold */ |
226 |
|
if (specthresh > FTINY && |
227 |
< |
((specthresh >= 1.-FTINY || |
228 |
< |
specthresh + |
229 |
< |
(.05 - .1*frandom()) > nd.tspec))) |
227 |
> |
(specthresh >= 1.-FTINY || |
228 |
> |
specthresh + .05 - .1*frandom() > nd.tspec)) |
229 |
|
nd.specfl |= SP_TBLT; |
230 |
|
if (DOT(r->pert,r->pert) <= FTINY*FTINY) { |
231 |
|
VCOPY(nd.prdir, r->rdir); |
245 |
|
/* diffuse reflection */ |
246 |
|
nd.rdiff = 1.0 - nd.trans - nd.rspec; |
247 |
|
|
248 |
< |
if (r->ro->otype == OBJ_FACE || r->ro->otype == OBJ_RING) |
248 |
> |
if (r->ro != NULL && (r->ro->otype == OBJ_FACE || |
249 |
> |
r->ro->otype == OBJ_RING)) |
250 |
|
nd.specfl |= SP_FLAT; |
251 |
|
|
252 |
|
getacoords(r, &nd); /* set up coordinates */ |