ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/m_alias.c
(Generate patch)

Comparing ray/src/rt/m_alias.c (file contents):
Revision 2.9 by greg, Fri Feb 16 18:37:51 2018 UTC vs.
Revision 2.10 by greg, Wed Dec 5 02:12:23 2018 UTC

# Line 36 | Line 36 | m_alias(                       /* transfer shading to alias target */
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;
48 >                        objerror(aop, INTERNAL, "bad # string arguments");
49                  if (aobj < 0)
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                        (ofun[arec.otype].flags & (T_M|T_X)) &&
58                        arec.otype != MAT_CLIP) {
59                if (istransp(arec.otype) || isBSDFproxy(&arec)) {
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 */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines