1 |
< |
/* Copyright (c) 1995 Regents of the University of California */ |
1 |
> |
/* Copyright (c) 1998 Silicon Graphics, Inc. */ |
2 |
|
|
3 |
|
#ifndef lint |
4 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
4 |
> |
static char SCCSid[] = "$SunId$ SGI"; |
5 |
|
#endif |
6 |
|
|
7 |
|
/* |
36 |
|
{ |
37 |
|
COLOR mcolor; |
38 |
|
RAY nr; |
39 |
+ |
int rpure = 1; |
40 |
|
register int i; |
41 |
|
/* check arguments */ |
42 |
|
if (m->oargs.nfargs != 3 || m->oargs.nsargs > 1) |
48 |
|
raytrans(r); |
49 |
|
return(1); |
50 |
|
} |
51 |
< |
return(rayshade(r, modifier(m->oargs.sarg[0]))); |
51 |
> |
return(rayshade(r, lastmod(objndx(m), m->oargs.sarg[0]))); |
52 |
|
} |
53 |
|
/* check for bad source ray */ |
54 |
|
if (r->rsrc >= 0 && source[r->rsrc].so != r->ro) |
77 |
|
|
78 |
|
if (rayorigin(&nr, r, REFLECTED, bright(mcolor)) < 0) |
79 |
|
return(1); |
80 |
< |
pdot = raynormal(pnorm, r); /* use textures */ |
81 |
< |
for (i = 0; i < 3; i++) |
82 |
< |
nr.rdir[i] = r->rdir[i] + 2.*pdot*pnorm[i]; |
80 |
> |
if (DOT(r->pert,r->pert) > FTINY*FTINY) { |
81 |
> |
pdot = raynormal(pnorm, r); /* use textures */ |
82 |
> |
for (i = 0; i < 3; i++) |
83 |
> |
nr.rdir[i] = r->rdir[i] + 2.*pdot*pnorm[i]; |
84 |
> |
rpure = 0; |
85 |
> |
} |
86 |
|
/* check for penetration */ |
87 |
< |
if (DOT(nr.rdir, r->ron) <= FTINY) |
87 |
> |
if (rpure || DOT(nr.rdir, r->ron) <= FTINY) |
88 |
|
for (i = 0; i < 3; i++) |
89 |
|
nr.rdir[i] = r->rdir[i] + 2.*r->rod*r->ron[i]; |
90 |
|
} |
91 |
|
rayvalue(&nr); |
92 |
|
multcolor(nr.rcol, mcolor); |
93 |
|
addcolor(r->rcol, nr.rcol); |
94 |
+ |
if (rpure && r->ro != NULL && isflat(r->ro->otype)) |
95 |
+ |
r->rt = r->rot + nr.rt; |
96 |
|
return(1); |
97 |
|
} |
98 |
|
|