9 |
|
|
10 |
|
#include "ray.h" |
11 |
|
|
12 |
+ |
#include "ambient.h" |
13 |
+ |
|
14 |
|
#include "data.h" |
15 |
|
|
16 |
|
#include "otypes.h" |
162 |
|
dtmp = funvalue(sa[0], 5, vldx); |
163 |
|
setcolor(ctmp, dtmp, dtmp, dtmp); |
164 |
|
} |
165 |
< |
if (errno) { |
165 |
> |
if (errno == EDOM || errno == ERANGE) { |
166 |
|
objerror(np->mp, WARNING, "compute error"); |
167 |
|
return; |
168 |
|
} |
172 |
|
/* |
173 |
|
* Compute reflected non-diffuse component. |
174 |
|
*/ |
175 |
< |
if (np->mp->otype == MAT_MFUNC | np->mp->otype == MAT_MDATA) |
175 |
> |
if ((np->mp->otype == MAT_MFUNC) | (np->mp->otype == MAT_MDATA)) |
176 |
|
multcolor(ctmp, np->mcolor); |
177 |
|
dtmp = ldot * omega * np->rspec; |
178 |
|
scalecolor(ctmp, dtmp); |
181 |
|
/* |
182 |
|
* Compute transmitted non-diffuse component. |
183 |
|
*/ |
184 |
< |
if (np->mp->otype == MAT_TFUNC | np->mp->otype == MAT_TDATA) |
184 |
> |
if ((np->mp->otype == MAT_TFUNC) | (np->mp->otype == MAT_TDATA)) |
185 |
|
multcolor(ctmp, np->mcolor); |
186 |
|
dtmp = -ldot * omega * np->tspec; |
187 |
|
scalecolor(ctmp, dtmp); |
206 |
|
register MFUNC *mf; |
207 |
|
register int i; |
208 |
|
/* check arguments */ |
209 |
< |
if (m->oargs.nsargs < 10 | m->oargs.nfargs < 9) |
209 |
> |
if ((m->oargs.nsargs < 10) | (m->oargs.nfargs < 9)) |
210 |
|
objerror(m, USER, "bad # arguments"); |
211 |
|
nd.mp = m; |
212 |
|
nd.pr = r; |
253 |
|
setcolor(ctmp, evalue(mf->ep[3]), |
254 |
|
evalue(mf->ep[4]), |
255 |
|
evalue(mf->ep[5])); |
256 |
< |
if (errno) |
256 |
> |
if (errno == EDOM || errno == ERANGE) |
257 |
|
objerror(m, WARNING, "compute error"); |
258 |
|
else if (rayorigin(&sr, r, TRANS, bright(ctmp)) == 0) { |
259 |
|
if (!(r->crtype & SHADOW) && |
282 |
|
setcolor(ctmp, evalue(mf->ep[0]), |
283 |
|
evalue(mf->ep[1]), |
284 |
|
evalue(mf->ep[2])); |
285 |
< |
if (errno) |
285 |
> |
if (errno == EDOM || errno == ERANGE) |
286 |
|
objerror(m, WARNING, "compute error"); |
287 |
|
else if (rayorigin(&sr, r, REFLECTED, bright(ctmp)) == 0) { |
288 |
|
for (i = 0; i < 3; i++) |
337 |
|
if (r->crtype & SHADOW) |
338 |
|
return(1); |
339 |
|
/* check arguments */ |
340 |
< |
if (m->oargs.nsargs < (hasdata(m->otype)?4:2) | m->oargs.nfargs < |
341 |
< |
(m->otype==MAT_TFUNC|m->otype==MAT_TDATA?6:4)) |
340 |
> |
if ((m->oargs.nsargs < (hasdata(m->otype)?4:2)) | (m->oargs.nfargs < |
341 |
> |
((m->otype==MAT_TFUNC)|(m->otype==MAT_TDATA)?6:4))) |
342 |
|
objerror(m, USER, "bad # arguments"); |
343 |
|
/* check for back side */ |
344 |
|
if (r->rod < 0.0) { |
361 |
|
/* get specular component */ |
362 |
|
nd.rspec = m->oargs.farg[3]; |
363 |
|
/* compute transmittance */ |
364 |
< |
if (m->otype == MAT_TFUNC | m->otype == MAT_TDATA) { |
364 |
> |
if ((m->otype == MAT_TFUNC) | (m->otype == MAT_TDATA)) { |
365 |
|
nd.trans = m->oargs.farg[4]*(1.0 - nd.rspec); |
366 |
|
nd.tspec = nd.trans * m->oargs.farg[5]; |
367 |
|
dtmp = nd.trans - nd.tspec; |