SubDiv: Incorrect normals loose edges

The normals of loose edges can be non uniform as they aren't normalized.
Checked with what happens with edit loose edges and synchronized the
implementation.

Reviewed By: Brecht van Lommel

Differential Revision: https://developer.blender.org/D7127
This commit is contained in:
Jeroen Bakker 2020-03-26 14:32:13 +01:00 committed by Jeroen Bakker
parent 0545a84729
commit 2e8fb95e7c
1 changed files with 5 additions and 2 deletions

View File

@ -1120,8 +1120,11 @@ static void subdiv_mesh_vertex_of_loose_edge(const struct SubdivForeachContext *
* it. Maybe even using vertex varying attributes. */
subdiv_vertex->bweight = 0.0f;
/* Reset normal, initialize it in a similar way as edit mode does for a
* vertices adjacent to a loose edges. */
normal_float_to_short_v3(subdiv_vertex->no, subdiv_vertex->co);
* vertices adjacent to a loose edges.
* See `mesh_evaluate#mesh_calc_normals_vert_fallback` */
float no[3];
normalize_v3_v3(no, subdiv_vertex->co);
normal_float_to_short_v3(subdiv_vertex->no, no);
}
/* =============================================================================