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.28 by greg, Sun Jan 31 17:49:21 2021 UTC vs.
Revision 2.29 by greg, Sun Jan 31 20:06:15 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;
110 >        OBJECT  obj = OVOID;
111  
112          while (!ismaterial(o->otype)) {
113                  if (o->otype == MOD_ALIAS && o->oargs.nsargs) {
114 <                        OBJREC  *ao;    /* check if aliased to material */
115 <                        if (mod == OVOID)
116 <                                mod = objndx(o);
117 <                        mod = lastmod(mod, o->oargs.sarg[0]);
118 <                        if (mod < 0)
119 <                                objerror(o, USER, "bad reference");
120 <                        while ((ao = objptr(mod))->otype == MOD_ALIAS &&
121 <                                        !ao->oargs.nsargs)
122 <                                mod = ao->omod;
114 >                        OBJREC  *ao = o;
115 >                        if (obj == OVOID)
116 >                                obj = objndx(o);
117 >                        do {
118 >                                if (!ao->oargs.nsargs)
119 >                                        obj = ao->omod;
120 >                                else
121 >                                        obj = lastmod(obj, ao->oargs.sarg[0]);
122 >                                if (obj < 0)
123 >                                        objerror(ao, USER, "bad reference");
124 >                                ao = objptr(obj);
125 >                        } while (ao->otype == MOD_ALIAS);
126 >                                        /* check if aliased to material */
127                          if (ismaterial(ao->otype))
128                                  return(ao);
129                  }
# Line 129 | Line 133 | findmaterial(OBJREC *o)                        /* find an object's actual m
133                                  break;
134                          return(NULL);   /* else no material found */
135                  }
136 <                o = objptr(mod = o->omod);
136 >                obj = o->omod;
137 >                o = objptr(obj);
138          }
139          return(o);
140   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines