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.21 by greg, Mon Jun 25 20:49:10 2018 UTC vs.
Revision 2.27 by greg, Sat Jan 30 17:53:19 2021 UTC

# Line 64 | Line 64 | initotypes(void)                       /* initialize ofun array */
64          ofun[MAT_CLIP].funp = m_clip;
65          ofun[MAT_BRTDF].funp = m_brdf;
66          ofun[MAT_BSDF].funp =
67 <        ofun[MAT_SBSDF].funp = m_bsdf;
68 <        ofun[MAT_SBSDF].flags |= T_TRANSP;
67 >        ofun[MAT_ABSDF].funp = m_bsdf;
68 >        ofun[MAT_ABSDF].flags |= T_TRANSP;
69          ofun[MAT_PFUNC].funp =
70          ofun[MAT_MFUNC].funp =
71          ofun[MAT_PDATA].funp =
# Line 74 | Line 74 | initotypes(void)                       /* initialize ofun array */
74          ofun[MAT_TDATA].funp = m_brdf2;
75          ofun[MAT_PFUNC].flags |= T_OPAQUE;
76          ofun[MAT_MFUNC].flags |= T_OPAQUE;
77 +        ofun[MAT_TFUNC].flags |= T_OPAQUE;
78          ofun[MAT_PDATA].flags |= T_OPAQUE;
79          ofun[MAT_MDATA].flags |= T_OPAQUE;
80 +        ofun[MAT_TDATA].flags |= T_OPAQUE;
81          ofun[TEX_FUNC].funp = t_func;
82          ofun[TEX_DATA].funp = t_data;
83          ofun[PAT_CFUNC].funp = p_cfunc;
# Line 93 | Line 95 | initotypes(void)                       /* initialize ofun array */
95  
96  
97   int
98 < o_default(OBJREC *o, RAY *r)                    /* default action is error */
98 > o_default(OBJREC *o, RAY *r)            /* default action is error */
99   {
100          objerror(o, CONSISTENCY, "unexpected object call");
101 <                                /* unused call to load freeobjmem.o */
101 >                                        /* unused call to load freeobjmem.o */
102          free_objs(0, 0);
103          return(0);
104 + }
105 +
106 +
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) {
114 +                        OBJREC  *ao;
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(mod))) != NULL)
122 +                                return(ao);
123 +                }
124 +                if (o->omod == OVOID) {
125 +                                        /* void mixture de facto material? */
126 +                        if (ismixture(o->otype))
127 +                                break;
128 +                        return(NULL);   /* else no material found */
129 +                }
130 +                o = objptr(mod = o->omod);
131 +        }
132 +        return(o);
133   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines