Freestyle: Added a piece of debug code for checking the consistency of face normals.

The code was found helpful while addressing T39669 and might help solving similar
issues related to face normals in the future.
This commit is contained in:
Tamito Kajiyama 2014-05-17 10:36:39 +09:00
parent f8554ed61a
commit 4958aff780
Notes: blender-bot 2023-02-14 10:18:56 +01:00
Referenced by commit 7a085b4c85, Revised the debug code added in the commit rB4958aff780a3 according to the raised concern.
1 changed files with 8 additions and 0 deletions

View File

@ -521,6 +521,14 @@ void BlenderFileLoader::insertShapeNode(ObjectInstanceRen *obi, int id)
}
else {
RE_vlakren_get_normal(_re, obi, vlr, facenormal);
if (G.debug & G_DEBUG_FREESTYLE) {
float dist, tmpNor[3];
normal_tri_v3(tmpNor, v3, v2, v1); /* normals are inverted in rendering */
dist = len_v3v3(facenormal, tmpNor);
if (dist > 1.0f) {
printf("Warning: vlak %d has an incorrect normal (dist. %.3g)\n", p, dist);
}
}
copy_v3_v3(n1, facenormal);
copy_v3_v3(n2, facenormal);
copy_v3_v3(n3, facenormal);