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

Comparing ray/src/ot/cvmesh.c (file contents):
Revision 2.7 by greg, Thu Sep 18 16:53:53 2003 UTC vs.
Revision 2.8 by greg, Thu Jan 29 22:21:34 2004 UTC

# Line 10 | Line 10 | static const char RCSid[] = "$Id$";
10   #include "cvmesh.h"
11   #include "otypes.h"
12   #include "face.h"
13 + #include "tmesh.h"
14  
15   /*
16   * We need to divide faces into triangles and record auxiliary information
# Line 169 | Line 170 | RREAL  vc1[2], vc2[2], vc3[2];
170          OBJREC          *fop;
171          int             j;
172          
173 <        flags = MT_V;
174 <        if (vn1 != NULL && vn2 != NULL && vn3 != NULL)
175 <                flags |= MT_N;
173 >        flags = MT_V;           /* check what we have */
174 >        if (vn1 != NULL && vn2 != NULL && vn3 != NULL) {
175 >                RREAL   *rp;
176 >                switch (flat_tri(vp1, vp2, vp3, vn1, vn2, vn3)) {
177 >                case ISBENT:
178 >                        flags |= MT_N;
179 >                        /* fall through */
180 >                case ISFLAT:
181 >                        break;
182 >                case RVBENT:
183 >                        flags |= MT_N;
184 >                        rp = vn1; vn1 = vn3; vn3 = rp;
185 >                        /* fall through */
186 >                case RVFLAT:
187 >                        rp = vp1; vp1 = vp3; vp3 = rp;
188 >                        rp = vc1; vc1 = vc3; vc3 = rp;
189 >                        break;
190 >                case DEGEN:
191 >                        error(WARNING, "degenerate triangle");
192 >                        return(0);
193 >                default:
194 >                        error(INTERNAL, "bad return from flat_tri()");
195 >                }
196 >        }
197          if (vc1 != NULL && vc2 != NULL && vc3 != NULL)
198                  flags |= MT_UV;
199          if (fobj == OVOID) {    /* create new triangle object */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines