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 |
< |
aop = m; |
39 |
> |
|
40 |
> |
aop = m; /* else look it up */ |
41 |
|
aobj = objndx(aop); |
42 |
< |
do { /* follow alias trail */ |
43 |
< |
if (aop->oargs.nsargs == 1) |
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 |
< |
aobj = aop->omod; |
49 |
< |
if (aobj < 0) |
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; |
55 |
– |
/* irradiance hack */ |
56 |
– |
if (do_irrad && !(r->crtype & ~(PRIMARY|TRANS)) && |
57 |
– |
m->otype != MAT_CLIP && |
58 |
– |
(ofun[arec.otype].flags & (T_M|T_X))) { |
59 |
– |
if (irr_ignore(arec.otype)) { |
60 |
– |
raytrans(r); |
61 |
– |
return(1); |
62 |
– |
} |
63 |
– |
if (!islight(arec.otype)) |
64 |
– |
return((*ofun[Lamb.otype].funp)(&Lamb, r)); |
65 |
– |
} |
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 */ |