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 |
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 */ |