Fix T50662: Auto-split affects on smooth mesh when it sohuldn't

Seems to be a precision error comparing proper floating point
normal with the one coming from short.
This commit is contained in:
Sergey Sharybin 2017-02-15 15:21:15 +01:00
parent fe47163a1e
commit efbe47f9cd
Notes: blender-bot 2023-02-14 11:07:28 +01:00
Referenced by issue #50662, 2.78b became slower on render and more vram consuming
1 changed files with 2 additions and 2 deletions

View File

@ -2172,7 +2172,7 @@ void BKE_mesh_split_faces(Mesh *mesh)
MVert *mv = &mvert[ml->v];
float vn[3];
normal_short_to_float_v3(vn, mv->no);
if (!equals_v3v3(vn, lnors[mp->loopstart + loop])) {
if (len_squared_v3v3(vn, lnors[mp->loopstart + loop]) > FLT_EPSILON) {
/* When vertex is adjacent to two faces and gets split we don't
* want new vertex counted for both faces. We tag it for re-use
* by one of the faces.
@ -2240,7 +2240,7 @@ void BKE_mesh_split_faces(Mesh *mesh)
MVert *mv = &mvert[ml->v];
float vn[3];
normal_short_to_float_v3(vn, mv->no);
if (!equals_v3v3(vn, lnors[mp->loopstart + loop])) {
if (len_squared_v3v3(vn, lnors[mp->loopstart + loop]) > FLT_EPSILON) {
if ((mv->flag & ME_VERT_TMP_TAG) == 0) {
/* Ignore first split on vertex, re-use it instead. */
mv->flag |= ME_VERT_TMP_TAG;