| 40 |
|
/* check arguments */ |
| 41 |
|
if (m->oargs.nfargs != 3 || m->oargs.nsargs > 1) |
| 42 |
|
objerror(m, USER, "bad number of arguments"); |
| 43 |
< |
/* check if source ray */ |
| 44 |
< |
if (r->rsrc >= 0) { /* aiming for somebody */ |
| 45 |
< |
if (source[r->rsrc].so != r->ro) |
| 46 |
< |
return; /* but not us */ |
| 47 |
< |
} else if (m->oargs.nsargs > 0) { /* else call substitute? */ |
| 43 |
> |
/* check for substitute material */ |
| 44 |
> |
if (m->oargs.nsargs > 0 && |
| 45 |
> |
(r->rsrc < 0 || source[r->rsrc].so != r->ro)) { |
| 46 |
|
rayshade(r, modifier(m->oargs.sarg[0])); |
| 47 |
|
return; |
| 48 |
|
} |
| 49 |
+ |
/* check for bad source ray */ |
| 50 |
+ |
if (r->rsrc >= 0 && source[r->rsrc].so != r->ro) |
| 51 |
+ |
return; |
| 52 |
+ |
|
| 53 |
|
if (r->rod < 0.) /* back is black */ |
| 54 |
|
return; |
| 55 |
|
/* get modifiers */ |
| 76 |
|
pdot = raynormal(pnorm, r); /* use textures */ |
| 77 |
|
for (i = 0; i < 3; i++) |
| 78 |
|
nr.rdir[i] = r->rdir[i] + 2.*pdot*pnorm[i]; |
| 79 |
+ |
/* check for penetration */ |
| 80 |
+ |
if (DOT(nr.rdir, r->ron) <= FTINY) |
| 81 |
+ |
for (i = 0; i < 3; i++) |
| 82 |
+ |
nr.rdir[i] = r->rdir[i] + 2.*r->rod*r->ron[i]; |
| 83 |
|
} |
| 84 |
|
rayvalue(&nr); |
| 85 |
|
multcolor(nr.rcol, mcolor); |