23 |
|
* chain at all. |
24 |
|
*/ |
25 |
|
|
26 |
< |
extern int |
26 |
> |
int |
27 |
|
m_alias( /* transfer shading to alias target */ |
28 |
|
OBJREC *m, |
29 |
|
RAY *r |
36 |
|
/* straight replacement? */ |
37 |
|
if (!m->oargs.nsargs) |
38 |
|
return(rayshade(r, m->omod)); |
39 |
< |
/* else replace alias */ |
40 |
< |
if (m->oargs.nsargs != 1) |
41 |
< |
objerror(m, INTERNAL, "bad # string arguments"); |
42 |
< |
aobj = lastmod(objndx(m), m->oargs.sarg[0]); |
43 |
< |
if (aobj < 0) |
44 |
< |
objerror(m, USER, "bad reference"); |
45 |
< |
aop = objptr(aobj); |
39 |
> |
|
40 |
> |
aop = m; /* else look it up */ |
41 |
> |
aobj = objndx(aop); |
42 |
> |
do { /* follow entire alias trail */ |
43 |
> |
if (!aop->oargs.nsargs) |
44 |
> |
aobj = aop->omod; |
45 |
> |
else if (aop->oargs.nsargs == 1) |
46 |
> |
aobj = lastmod(aobj, aop->oargs.sarg[0]); |
47 |
> |
else |
48 |
> |
objerror(aop, INTERNAL, "bad # string arguments"); |
49 |
> |
if (aobj == OVOID) |
50 |
> |
objerror(aop, USER, "bad reference"); |
51 |
> |
aop = objptr(aobj); |
52 |
> |
} while (aop->otype == MOD_ALIAS); |
53 |
> |
/* copy struct */ |
54 |
|
arec = *aop; |
47 |
– |
/* irradiance hack */ |
48 |
– |
if (do_irrad && !(r->crtype & ~(PRIMARY|TRANS)) && |
49 |
– |
m->otype != MAT_CLIP && |
50 |
– |
(ofun[arec.otype].flags & (T_M|T_X))) { |
51 |
– |
if (irr_ignore(arec.otype)) { |
52 |
– |
raytrans(r); |
53 |
– |
return(1); |
54 |
– |
} |
55 |
– |
if (!islight(arec.otype)) |
56 |
– |
return((*ofun[Lamb.otype].funp)(&Lamb, r)); |
57 |
– |
} |
55 |
|
/* substitute modifier */ |
56 |
|
arec.omod = m->omod; |
57 |
+ |
/* irradiance hack */ |
58 |
+ |
if (do_irrad && !(r->crtype & ~(PRIMARY|TRANS)) && raytirrad(&arec, r)) |
59 |
+ |
return(1); |
60 |
|
/* replacement shader */ |
61 |
|
rval = (*ofun[arec.otype].funp)(&arec, r); |
62 |
|
/* save allocated struct */ |