9 |
|
|
10 |
|
#include "ray.h" |
11 |
|
#include "otypes.h" |
12 |
+ |
#include "otspecial.h" |
13 |
|
#include "rtotypes.h" |
14 |
|
#include "source.h" |
15 |
|
|
45 |
|
objerror(m, USER, "bad number of arguments"); |
46 |
|
/* check for substitute material */ |
47 |
|
/* but avoid double-counting */ |
48 |
< |
if ( m->oargs.nsargs > 0 && |
49 |
< |
(r->rsrc < 0 || source[r->rsrc].so != r->ro) && |
50 |
< |
!(r->crtype & (AMBIENT|SPECULAR) && r->rod > 0.) ) { |
51 |
< |
if (!strcmp(m->oargs.sarg[0], VOIDID)) { |
52 |
< |
raytrans(r); |
48 |
> |
if (m->oargs.nsargs > 0 && |
49 |
> |
(r->rsrc < 0 || source[r->rsrc].so != r->ro)) { |
50 |
> |
int passOK = (r->rod < 0.) | |
51 |
> |
!(r->crtype & (AMBIENT|SPECULAR)); |
52 |
> |
if (strcmp(m->oargs.sarg[0], VOIDID)) { |
53 |
> |
OBJECT altmod = lastmod(objndx(m), m->oargs.sarg[0]); |
54 |
> |
OBJREC *altmat; |
55 |
> |
if (passOK) /* no double-count hazard? */ |
56 |
> |
return(rayshade(r, altmod)); |
57 |
> |
if (altmod == OVOID || /* else check alternate type */ |
58 |
> |
(altmat = findmaterial(objptr(altmod))) == NULL) |
59 |
> |
return(0); |
60 |
> |
if (istransp(altmat)) /* pass "transparent" materials */ |
61 |
> |
return(rayshade(r, altmod)); |
62 |
> |
} else if (passOK) { |
63 |
> |
raytrans(r); /* "safe" void passage */ |
64 |
|
return(1); |
65 |
|
} |
54 |
– |
return(rayshade(r, lastmod(objndx(m), m->oargs.sarg[0]))); |
66 |
|
} |
67 |
|
/* check for bad source ray */ |
68 |
|
if (r->rsrc >= 0 && source[r->rsrc].so != r->ro) |