1 |
< |
/* Copyright (c) 1986 Regents of the University of California */ |
1 |
> |
/* Copyright (c) 1991 Regents of the University of California */ |
2 |
|
|
3 |
|
#ifndef lint |
4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
129 |
|
register RAY *r; |
130 |
|
{ |
131 |
|
NORMDAT nd; |
132 |
< |
double ldot; |
133 |
< |
double omega; |
132 |
> |
double transtest, transdist; |
133 |
|
double dtmp; |
134 |
|
COLOR ctmp; |
135 |
|
register int i; |
155 |
|
raytexture(r, m->omod); |
156 |
|
nd.pdot = raynormal(nd.pnorm, r); /* perturb normal */ |
157 |
|
multcolor(nd.mcolor, r->pcol); /* modify material color */ |
158 |
+ |
transtest = 0; |
159 |
|
/* get specular component */ |
160 |
|
nd.rspec = m->oargs.farg[3]; |
161 |
|
|
196 |
|
if (nd.tspec > FTINY && nd.alpha2 <= FTINY) { |
197 |
|
RAY lr; |
198 |
|
if (rayorigin(&lr, r, TRANS, nd.tspec) == 0) { |
199 |
< |
VCOPY(lr.rdir, r->rdir); |
199 |
> |
if (!(r->crtype & SHADOW) && |
200 |
> |
DOT(r->pert,r->pert) > FTINY*FTINY) { |
201 |
> |
for (i = 0; i < 3; i++) /* perturb direction */ |
202 |
> |
lr.rdir[i] = r->rdir[i] - |
203 |
> |
.75*r->pert[i]; |
204 |
> |
normalize(lr.rdir); |
205 |
> |
} else { |
206 |
> |
VCOPY(lr.rdir, r->rdir); |
207 |
> |
transtest = 2; |
208 |
> |
} |
209 |
|
rayvalue(&lr); |
210 |
|
scalecolor(lr.rcol, nd.tspec); |
211 |
+ |
multcolor(lr.rcol, nd.mcolor); /* modified by color */ |
212 |
|
addcolor(r->rcol, lr.rcol); |
213 |
+ |
transtest *= bright(lr.rcol); |
214 |
+ |
transdist = r->rot + lr.rt; |
215 |
|
} |
216 |
|
} |
217 |
|
if (r->crtype & SHADOW) /* the rest is shadow */ |
244 |
|
} |
245 |
|
/* add direct component */ |
246 |
|
direct(r, dirnorm, &nd); |
247 |
+ |
/* check distance */ |
248 |
+ |
if (transtest > bright(r->rcol)) |
249 |
+ |
r->rt = transdist; |
250 |
|
} |