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.1 by greg, Tue Mar 11 17:08:55 2003 UTC vs.
Revision 2.3 by greg, Wed Mar 12 04:59:05 2003 UTC

# Line 28 | Line 28 | static const char RCSid[] = "$Id$";
28   #include  "tmesh.h"
29  
30  
31 < #define  EDGE_CACHE_SIZ         109     /* length of mesh edge cache */
31 > #define  EDGE_CACHE_SIZ         251     /* length of mesh edge cache */
32  
33   #define  curmi                  (edge_cache.mi)
34   #define  curmsh                 (curmi->msh)
# Line 68 | Line 68 | int4           v1, v2;
68                  int4    t = v2; v2 = v1; v1 = t;
69                  reversed = 1;
70          }
71 <        ecp = &edge_cache.cache[(v2<<11 ^ v1) % EDGE_CACHE_SIZ];
71 >        ecp = &edge_cache.cache[((v2<<11 ^ v1) & 0x7fffffff) % EDGE_CACHE_SIZ];
72          if (ecp->v1i != v1 || ecp->v2i != v2) {
73                  MESHVERT        tv1, tv2;       /* compute signed volume */
74                  double          vol;
75                  if (!getmeshvert(&tv1, edge_cache.mi->msh, v1, MT_V) ||
76 <                                !getmeshvert(&tv2, edge_cache.mi->msh, v2, MT_V))
76 >                            !getmeshvert(&tv2, edge_cache.mi->msh, v2, MT_V))
77                          objerror(edge_cache.o, INTERNAL,
78 <                                        "missing mesh vertex in signed_volume");
78 >                                "missing mesh vertex in signed_volume");
79                  vol = (tv1.v[0] - r->rorg[0]) *
80                                  ( (tv2.v[1] - r->rorg[1])*r->rdir[2] -
81                                    (tv2.v[2] - r->rorg[2])*r->rdir[1] );
# Line 113 | Line 113 | RAY    *r;
113          for (i = oset[0]; i > 0; i--) {
114                  if (!getmeshtrivid(tvi, curmsh, oset[i]))
115                          objerror(edge_cache.o, INTERNAL,
116 <                                        "missing triangle vertices in mesh_hit");
116 >                                "missing triangle vertices in mesh_hit");
117                  sv1 = signed_volume(r, tvi[0], tvi[1]);
118                  sv2 = signed_volume(r, tvi[1], tvi[2]);
119                  sv3 = signed_volume(r, tvi[2], tvi[0]);
# Line 139 | Line 139 | RAY    *r;
139                  r->rot = d;
140                  VSUM(r->rop, r->rorg, r->rdir, d);
141                  VCOPY(r->ron, nrm);
142 <                /* normalize(r->ron) called in o_mesh() & rod set */
142 >                /* normalize(r->ron) called & r->rod set in o_mesh() */
143          }
144   }
145  
# Line 197 | Line 197 | register RAY   *r;
197                  if (normalize(r->pert) != 0.0)
198                          for (i = 0; i < 3; i++)
199                                  r->pert[i] -= r->ron[i];
200 <        }
200 >        } else
201 >                r->pert[0] = r->pert[1] = r->pert[2] = .0;
202 >
203          if (flags & MT_UV)              /* interpolate uv coordinates */
204                  for (i = 0; i < 2; i++)
205                          r->uv[i] = wt[0]*tv[0].uv[i] +
206                                          wt[1]*tv[1].uv[i] +
207                                          wt[2]*tv[2].uv[i];
208 +        else
209 +                r->uv[0] = r->uv[1] = .0;
210  
211                                          /* return hit */
212          return(1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines