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

Comparing ray/src/rt/m_wgmdf.c (file contents):
Revision 2.10 by greg, Fri May 23 17:09:26 2025 UTC vs.
Revision 2.11 by greg, Sat May 31 00:54:34 2025 UTC

# Line 94 | Line 94 | typedef struct {
94          RAY             *rp;            /* ray pointer */
95          OBJREC          *mtp;           /* material pointer */
96          MFUNC           *mf;            /* pointer to expression list */
97 +        OBJECT          mto;            /* material object index (or -2) */
98          int             specfl;         /* specularity flags, defined above */
99          FVECT           ulocal;         /* u-vector in local coordinates */
100          DCOMP           rd, td;         /* diffuse component params */
# Line 101 | Line 102 | typedef struct {
102          FVECT           prdir;          /* vector in transmitted direction */
103   } WGMDDAT;              /* WGMD material data */
104  
105 < #define clr_comps(wp)   ((wp)->specfl = 0, \
105 > #define clr_comps(wp)   ((wp)->specfl = 0, (wp)->mto = OVOID-1, \
106                          (wp)->rd.mo.nam = (wp)->td.mo.nam = \
107                          (wp)->rs.mo.nam = (wp)->ts.mo.nam = "")
108  
# Line 133 | Line 134 | set_modval(MODVAL *mp, OBJECT omod, const RAY *r)
134  
135   /* fill modifier values, using previous setting if found */
136   static int
137 < fill_modval(MODVAL *mp, const WGMDDAT *wp)
137 > fill_modval(MODVAL *mp, WGMDDAT *wp)
138   {
139          if (mp == &wp->rd.mo) {         /* special case (should be first) */
140                  set_modval(mp, wp->mtp->omod, wp->rp);
# Line 154 | Line 155 | fill_modval(MODVAL *mp, const WGMDDAT *wp)
155          if (mp != &wp->ts.mo && !strcmp(mp->nam, wp->ts.mo.nam)) {
156                  *mp = wp->ts.mo;
157                  return(1);
158 <        }                               /* new modifier */
159 <        return(set_modval(mp, lastmod(objndx(wp->mtp), mp->nam), wp->rp));
158 >        }
159 >        if (wp->mto < OVOID)
160 >                wp->mto = objndx(wp->mtp);
161 >                                        /* new modifier */
162 >        return(set_modval(mp, lastmod(wp->mto, mp->nam), wp->rp));
163   }
164  
165   /* set calculation context for given component of MAT_WGMDF */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines