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

Comparing ray/src/rt/initotypes.c (file contents):
Revision 2.26 by greg, Thu Apr 18 22:58:03 2019 UTC vs.
Revision 2.27 by greg, Sat Jan 30 17:53:19 2021 UTC

# Line 107 | Line 107 | o_default(OBJREC *o, RAY *r)           /* default action is err
107   OBJREC *        
108   findmaterial(OBJREC *o)                 /* find an object's actual material */
109   {
110 +        OBJECT  mod = OVOID;
111 +
112          while (!ismaterial(o->otype)) {
113                  if (o->otype == MOD_ALIAS && o->oargs.nsargs) {
112                        OBJECT  aobj;
114                          OBJREC  *ao;
115 <                        aobj = lastmod(objndx(o), o->oargs.sarg[0]);
116 <                        if (aobj < 0)
115 >                        if (mod < 0)
116 >                                mod = objndx(o);
117 >                        mod = lastmod(mod, o->oargs.sarg[0]);
118 >                        if (mod < 0)
119                                  objerror(o, USER, "bad reference");
120                                          /* recursive check on alias branch */
121 <                        if ((ao = findmaterial(objptr(aobj))) != NULL)
121 >                        if ((ao = findmaterial(objptr(mod))) != NULL)
122                                  return(ao);
123                  }
124                  if (o->omod == OVOID) {
# Line 124 | Line 127 | findmaterial(OBJREC *o)                        /* find an object's actual m
127                                  break;
128                          return(NULL);   /* else no material found */
129                  }
130 <                o = objptr(o->omod);
130 >                o = objptr(mod = o->omod);
131          }
132          return(o);
133   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines