Freestyle: Fix for wrong assertion failure upon inverted face normals.

The assertion code was not taking quad faces into account.

Problem report by Folkert de Vries (flokkievids) through personal
communications, thanks!
This commit is contained in:
Tamito Kajiyama 2015-06-18 08:24:03 +09:00
parent 18f228d593
commit 530034511c
Notes: blender-bot 2023-02-14 08:59:16 +01:00
Referenced by issue #45115, Hair system and modifier stack order bug
1 changed files with 5 additions and 1 deletions

View 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);