51 |
|
|
52 |
|
#define MINCOS 0.997 /* minimum dot product for dispersion */ |
53 |
|
|
54 |
< |
static |
55 |
< |
double |
54 |
> |
static double |
55 |
|
mylog( /* special log for extinction coefficients */ |
56 |
|
double x |
57 |
|
) |
74 |
|
COLOR ctrans; |
75 |
|
COLOR talb; |
76 |
|
int hastexture; |
78 |
– |
double transdist=0, transtest=0; |
79 |
– |
double mirdist=0, mirtest=0; |
77 |
|
int flatsurface; |
78 |
|
double refl, trans; |
79 |
|
FVECT dnorm; |
81 |
|
RAY p; |
82 |
|
int i; |
83 |
|
|
84 |
< |
/* PMAP: skip refracted shadow ray if accounted for by photon map */ |
85 |
< |
if (shadowRayInPmap(r)) |
84 |
> |
/* PMAP: skip refracted shadow or ambient ray if accounted for in |
85 |
> |
photon map */ |
86 |
> |
if (shadowRayInPmap(r) || ambRayInPmap(r)) |
87 |
|
return(1); |
88 |
|
|
89 |
|
if (m->oargs.nfargs != (m->otype==MAT_DIELECTRIC ? 5 : 8)) |
204 |
|
/* virtual distance */ |
205 |
|
if (flatsurface || |
206 |
|
(1.-FTINY <= nratio) & |
207 |
< |
(nratio <= 1.+FTINY)) { |
208 |
< |
transtest = 2*bright(p.rcol); |
211 |
< |
transdist = r->rot + p.rt; |
212 |
< |
} |
207 |
> |
(nratio <= 1.+FTINY)) |
208 |
> |
r->rxt = r->rot + raydistance(&p); |
209 |
|
} |
210 |
|
} |
211 |
|
} |
223 |
|
rayvalue(&p); /* reflected ray value */ |
224 |
|
|
225 |
|
multcolor(p.rcol, p.rcoef); /* color contribution */ |
226 |
+ |
copycolor(r->mcol, p.rcol); |
227 |
|
addcolor(r->rcol, p.rcol); |
228 |
|
/* virtual distance */ |
229 |
< |
if (flatsurface) { |
230 |
< |
mirtest = 2*bright(p.rcol); |
231 |
< |
mirdist = r->rot + p.rt; |
235 |
< |
} |
229 |
> |
r->rmt = r->rot; |
230 |
> |
if (flatsurface) |
231 |
> |
r->rmt += raydistance(&p); |
232 |
|
} |
237 |
– |
/* check distance to return */ |
238 |
– |
d1 = bright(r->rcol); |
239 |
– |
if (transtest > d1) |
240 |
– |
r->rt = transdist; |
241 |
– |
else if (mirtest > d1) |
242 |
– |
r->rt = mirdist; |
233 |
|
/* rayvalue() computes absorption */ |
234 |
|
return(1); |
235 |
|
} |