Freestyle: Fix for wrong assertion failure upon inverted face normals.
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>
Wed, 17 Jun 2015 23:24:03 +0000 (08:24 +0900)
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>
Wed, 17 Jun 2015 23:28:35 +0000 (08:28 +0900)
The assertion code was not taking quad faces into account.

Problem report by Folkert de Vries (flokkievids) through personal
communications, thanks!

source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp

index bcb38bc59711f029ff1705992d164e7d6b1e8de6..7a61b735c4d20f8f6e9b0a839552e4b36d4f769d 100644 (file)
@@ -536,8 +536,12 @@ void BlenderFileLoader::insertShapeNode(ObjectInstanceRen *obi, int id)
                else {
                        RE_vlakren_get_normal(_re, obi, vlr, facenormal);
 #ifndef NDEBUG
+                       /* test if normals are inverted in rendering [T39669] */
                        float tnor[3];
-                       normal_tri_v3(tnor, v3, v2, v1);  /* normals are inverted in rendering */
+                       if (vlr->v4)
+                               normal_quad_v3(tnor, v4, v3, v2, v1);
+                       else
+                               normal_tri_v3(tnor, v3, v2, v1);
                        BLI_assert(dot_v3v3(tnor, facenormal) > 0.0f);
 #endif
                        copy_v3_v3(n1, facenormal);