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.25 by greg, Sat Nov 10 16:12:26 2018 UTC vs.
Revision 2.31 by greg, Wed Nov 15 18:02:52 2023 UTC

# Line 84 | Line 84 | initotypes(void)                       /* initialize ofun array */
84          ofun[PAT_BFUNC].funp = p_bfunc;
85          ofun[PAT_CPICT].funp = p_pdata;
86          ofun[PAT_CDATA].funp = p_cdata;
87 +        ofun[PAT_SPECTRUM].funp = p_spectrum;
88 +        ofun[PAT_SPECFILE].funp = p_specfile;
89 +        ofun[PAT_SPECFUNC].funp = p_specfunc;
90          ofun[PAT_BDATA].funp = p_bdata;
91          ofun[PAT_CTEXT].funp =
92          ofun[PAT_BTEXT].funp =
# Line 95 | Line 98 | initotypes(void)                       /* initialize ofun array */
98  
99  
100   int
101 < o_default(OBJREC *o, RAY *r)                    /* default action is error */
101 > o_default(OBJREC *o, RAY *r)            /* default action is error */
102   {
103          objerror(o, CONSISTENCY, "unexpected object call");
104 <                                /* unused call to load freeobjmem.o */
104 >                                        /* unused call to load freeobjmem.o */
105          free_objs(0, 0);
106          return(0);
107   }
108  
109  
110 <
111 < OBJREC *                        /* find an object's actual material */
109 < findmaterial(OBJREC *o)
110 > OBJREC *        
111 > findmaterial(OBJREC *o)                 /* find an object's actual material */
112   {
113 +        OBJECT  obj = OVOID;
114 +
115          while (!ismaterial(o->otype)) {
116                  if (o->otype == MOD_ALIAS && o->oargs.nsargs) {
117 <                        OBJECT  aobj;
118 <                        OBJREC  *ao;
119 <                        aobj = lastmod(objndx(o), o->oargs.sarg[0]);
120 <                        if (aobj < 0)
121 <                                objerror(o, USER, "bad reference");
122 <                                /* recursive check on alias branch */
123 <                        if ((ao = findmaterial(objptr(aobj))) != NULL)
117 >                        OBJREC  *ao = o;
118 >                        if (obj == OVOID)
119 >                                obj = objndx(o);
120 >                        do {
121 >                                if (!ao->oargs.nsargs)
122 >                                        obj = ao->omod;
123 >                                else
124 >                                        obj = lastmod(obj, ao->oargs.sarg[0]);
125 >                                if (obj == OVOID)
126 >                                        objerror(ao, USER, "bad reference");
127 >                                ao = objptr(obj);
128 >                        } while (ao->otype == MOD_ALIAS);
129 >                                        /* check if aliased to material */
130 >                        if (ismaterial(ao->otype))
131                                  return(ao);
132                  }
133                  if (o->omod == OVOID) {
134 <                                /* assume unmodified mixture is material */
134 >                                        /* void mixture de facto material? */
135                          if (ismixture(o->otype))
136                                  break;
137 <                        return(NULL);
137 >                        return(NULL);   /* else no material found */
138                  }
139 <                o = objptr(o->omod);
139 >                obj = o->omod;
140 >                o = objptr(obj);
141          }
142          return(o);
143   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines