64 |
|
} |
65 |
|
|
66 |
|
|
67 |
< |
extern int |
67 |
> |
int |
68 |
|
m_dielectric( /* color a ray which hit a dielectric interface */ |
69 |
|
OBJREC *m, |
70 |
< |
register RAY *r |
70 |
> |
RAY *r |
71 |
|
) |
72 |
|
{ |
73 |
|
double cos1, cos2, nratio; |
74 |
|
COLOR ctrans; |
75 |
|
COLOR talb; |
76 |
|
int hastexture; |
77 |
< |
double transdist, transtest=0; |
78 |
< |
double mirdist, mirtest=0; |
77 |
> |
double transdist=0, transtest=0; |
78 |
> |
double mirdist=0, mirtest=0; |
79 |
|
int flatsurface; |
80 |
|
double refl, trans; |
81 |
|
FVECT dnorm; |
82 |
|
double d1, d2; |
83 |
|
RAY p; |
84 |
< |
register int i; |
84 |
> |
int i; |
85 |
|
|
86 |
|
if (m->oargs.nfargs != (m->otype==MAT_DIELECTRIC ? 5 : 8)) |
87 |
|
objerror(m, USER, "bad arguments"); |
94 |
|
VCOPY(dnorm, r->ron); |
95 |
|
cos1 = r->rod; |
96 |
|
} |
97 |
< |
flatsurface = !hastexture && r->ro != NULL && isflat(r->ro->otype); |
97 |
> |
flatsurface = r->ro != NULL && isflat(r->ro->otype) && |
98 |
> |
!hastexture | (r->crtype & AMBIENT); |
99 |
|
|
100 |
|
/* index of refraction */ |
101 |
|
if (m->otype == MAT_DIELECTRIC) |
200 |
|
addcolor(r->rcol, p.rcol); |
201 |
|
/* virtual distance */ |
202 |
|
if (flatsurface || |
203 |
< |
(1.-FTINY <= nratio && |
204 |
< |
nratio <= 1.+FTINY)) { |
203 |
> |
(1.-FTINY <= nratio) & |
204 |
> |
(nratio <= 1.+FTINY)) { |
205 |
|
transtest = 2*bright(p.rcol); |
206 |
|
transdist = r->rot + p.rt; |
207 |
|
} |
381 |
|
|
382 |
|
static int |
383 |
|
lambda( /* compute lambda for material */ |
384 |
< |
register OBJREC *m, |
384 |
> |
OBJREC *m, |
385 |
|
FVECT v2, |
386 |
|
FVECT dv, |
387 |
|
FVECT lr |