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

Comparing ray/src/rt/o_mesh.c (file contents):
Revision 2.4 by greg, Wed Mar 12 17:26:58 2003 UTC vs.
Revision 2.5 by greg, Fri Mar 14 21:27:46 2003 UTC

# Line 105 | Line 105 | RAY    *r;
105          int4            tvi[3];
106          int             sv1, sv2, sv3;
107          MESHVERT        tv[3];
108 +        OBJECT          tmod;
109          FVECT           va, vb, nrm;
110          double          d;
111          int             i;
112                                          /* check each triangle */
113          for (i = oset[0]; i > 0; i--) {
114 <                if (!getmeshtrivid(tvi, curmsh, oset[i]))
114 >                if (!getmeshtrivid(tvi, &tmod, curmsh, oset[i]))
115                          objerror(edge_cache.o, INTERNAL,
116                                  "missing triangle vertices in mesh_hit");
117                  sv1 = signed_volume(r, tvi[0], tvi[1]);
# Line 151 | Line 152 | register RAY   *r;
152          RAY             rcont;
153          int             flags;
154          MESHVERT        tv[3];
155 +        OBJECT          tmod;
156          FLOAT           wt[3];
157          int             i;
158                                          /* get the mesh instance */
# Line 169 | Line 171 | register RAY   *r;
171                  return(0);                      /* missed */
172          if (rcont.rot * curmi->x.f.sca >= r->rot)
173                  return(0);                      /* not close enough */
172
173        r->robj = objndx(o);            /* record new hit */
174        r->ro = o;
174                                          /* transform ray back */
175          r->rot = rcont.rot * curmi->x.f.sca;
176          multp3(r->rop, rcont.rop, curmi->x.f.xfm);
177          multv3(r->ron, rcont.ron, curmi->x.f.xfm);
178          normalize(r->ron);
179          r->rod = -DOT(r->rdir, r->ron);
180 <                                        /* compute barycentric weights */
181 <        flags = getmeshtri(tv, curmsh, rcont.robj, MT_ALL);
180 >                                        /* get triangle */
181 >        flags = getmeshtri(tv, &tmod, curmsh, rcont.robj, MT_ALL);
182          if (!(flags & MT_V))
183                  objerror(o, INTERNAL, "missing mesh vertices in o_mesh");
184 +        r->robj = objndx(o);            /* set object and material */
185 +        if (o->omod == OVOID && tmod != OVOID) {
186 +                r->ro = getmeshpseudo(curmsh, tmod);
187 +                r->rox = &curmi->x;
188 +        } else
189 +                r->ro = o;
190 +                                        /* compute barycentric weights */
191          if (flags & (MT_N|MT_UV))
192                  if (get_baryc(wt, rcont.rop, tv[0].v, tv[1].v, tv[2].v) < 0) {
193                          objerror(o, WARNING, "bad triangle in o_mesh");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines