NormalOverlay: Center Dot Normal Drawing With Modifiers

When using generative modifiers too many center dots were rendered in
the normal overlay. This patch only renders the normals of original
center dots.

Known issue: decoding the `norAndFlag` has issues on Intel GPU.
This commit is contained in:
Jeroen Bakker 2020-03-30 14:39:16 +02:00
parent 57d8bde088
commit a2d19c1f78
Notes: blender-bot 2023-02-14 02:30:11 +01:00
Referenced by issue #77090, Generative modifiers (solidify, mirror) draw face normals from original face (wrong direction)
2 changed files with 6 additions and 3 deletions

View File

@ -40,7 +40,7 @@ void main()
}
else {
nor = norAndFlag.xyz;
if (all(equal(nor, vec3(0.0)))) {
if (all(equal(nor, vec3(0)))) {
finalColor = vec4(0.0);
return;
}

View File

@ -3914,7 +3914,8 @@ static void extract_fdots_nor_finish(const MeshRenderData *mr, void *buf, void *
for (int f = 0; f < mr->poly_len; f++) {
efa = BM_face_at_index(mr->bm, f);
const bool is_face_hidden = BM_elem_flag_test(efa, BM_ELEM_HIDDEN);
if (is_face_hidden) {
if (is_face_hidden ||
(mr->extract_type == MR_EXTRACT_MAPPED && mr->p_origindex[f] == ORIGINDEX_NONE)) {
nor[f] = GPU_normal_convert_i10_v3(invalid_normal);
nor[f].w = NOR_AND_FLAG_HIDDEN;
}
@ -3930,7 +3931,9 @@ static void extract_fdots_nor_finish(const MeshRenderData *mr, void *buf, void *
else {
for (int f = 0; f < mr->poly_len; f++) {
efa = bm_original_face_get(mr, f);
if (!efa || BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
const bool is_face_hidden = efa && BM_elem_flag_test(efa, BM_ELEM_HIDDEN);
if (is_face_hidden ||
(mr->extract_type == MR_EXTRACT_MAPPED && mr->p_origindex[f] == ORIGINDEX_NONE)) {
nor[f] = GPU_normal_convert_i10_v3(invalid_normal);
nor[f].w = NOR_AND_FLAG_HIDDEN;
}