diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-03-05 23:01:12 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-03-05 23:01:12 +0400 |
commit | e9eed190e83eb351aeb435d21287eaf37fcffeb0 (patch) | |
tree | 9a14be6b18c32a49ba110d18fefaedda5d5b3bef /source/blender/freestyle/intern/blender_interface/BlenderFileLoader.h | |
parent | bdc13c04de345b890298ce64e2e130a0769639f9 (diff) |
Another possible fix for degenerate triangles in imported mesh data.
A motivating example of the problem the present solution aims to address is a
quad face such that three of the four vertices are colinear (i.e., they are
lying on a line). Depending on how this quad is separated into two triangles,
one of them can be a degenerate triangle. Degenerate triangles of this form
are easy to avoid by rotating the diagonal edge of quad faces without affecting
the visual outcome. The fix implemented in this commit tries to address
degenerate triangles in this way.
Diffstat (limited to 'source/blender/freestyle/intern/blender_interface/BlenderFileLoader.h')
-rw-r--r-- | source/blender/freestyle/intern/blender_interface/BlenderFileLoader.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.h b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.h index 2e3c9da2814..804b1eb635d 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.h +++ b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.h @@ -66,6 +66,8 @@ public: protected: void insertShapeNode(ObjectInstanceRen *obi, int id); + int testDegenerateTriangle(float v1[3], float v2[3], float v3[3]); + bool testEdgeRotation(float v1[3], float v2[3], float v3[3], float v4[3]); int countClippedFaces(float v1[3], float v2[3], float v3[3], int clip[3]); void clipLine(float v1[3], float v2[3], float c[3], float z); void clipTriangle(int numTris, float triCoords[][3], float v1[3], float v2[3], float v3[3], @@ -75,6 +77,11 @@ protected: float n1[3], float n2[3], float n3[3], bool fm, bool em1, bool em2, bool em3); protected: + struct detri_t { + unsigned viA, viB, viP; // 0 <= viA, viB, viP < viSize + Vec3r v; + unsigned n; + }; Render* _re; SceneRenderLayer* _srl; NodeGroup* _Scene; |