Edit Mode: Fix loose edges edit mode normal display broken
authorClément Foucault <foucault.clem@gmail.com>
Tue, 5 Feb 2019 13:58:47 +0000 (14:58 +0100)
committerClément Foucault <foucault.clem@gmail.com>
Tue, 5 Feb 2019 14:02:15 +0000 (15:02 +0100)
source/blender/draw/intern/draw_cache_impl_mesh.c

index 016631e84d0ac33cbdc9860df224d7d9b3b531b7..4a5f134929ca16baac5a88298adb85a73825c70d 100644 (file)
@@ -2475,6 +2475,9 @@ static void mesh_create_edit_vertex_loops(
                                        mesh_render_data_vert_flag(rdata, eve, &eattr);
                                        memcpy(GPU_vertbuf_raw_step(&raw_data), &eattr, sizeof(EdgeDrawAttr));
                                }
+                               if (vbo_lnor) {
+                                       memset(GPU_vertbuf_raw_step(&raw_lnor), 0, sizeof(GPUPackedNormal));
+                               }
                                /* Select Idx */
                                if (vbo_verts) {
                                        int vidx = BM_elem_index_get(eve);
@@ -2494,6 +2497,9 @@ static void mesh_create_edit_vertex_loops(
                                *vnor = GPU_normal_convert_i10_v3(eve->no);
                                copy_v3_v3(GPU_vertbuf_raw_step(&raw_pos), eve->co);
                        }
+                       if (vbo_lnor) {
+                               memset(GPU_vertbuf_raw_step(&raw_lnor), 0, sizeof(GPUPackedNormal));
+                       }
                        if (vbo_data) {
                                EdgeDrawAttr eattr = { 0 };
                                mesh_render_data_vert_flag(rdata, eve, &eattr);
@@ -2596,6 +2602,9 @@ static void mesh_create_edit_vertex_loops(
                                        *(GPUPackedNormal *)GPU_vertbuf_raw_step(&raw_nor) = vnor;
                                        copy_v3_v3(GPU_vertbuf_raw_step(&raw_pos), mvert[v].co);
                                }
+                               if (vbo_lnor) {
+                                       memset(GPU_vertbuf_raw_step(&raw_lnor), 0, sizeof(GPUPackedNormal));
+                               }
                                if (vbo_data) {
                                        EdgeDrawAttr eattr = { 0 };
                                        int vidx = v_origindex[v];
@@ -2629,6 +2638,9 @@ static void mesh_create_edit_vertex_loops(
                                *(GPUPackedNormal *)GPU_vertbuf_raw_step(&raw_nor) = vnor;
                                copy_v3_v3(GPU_vertbuf_raw_step(&raw_pos), mvert[v].co);
                        }
+                       if (vbo_lnor) {
+                               memset(GPU_vertbuf_raw_step(&raw_lnor), 0, sizeof(GPUPackedNormal));
+                       }
                        if (vbo_data) {
                                EdgeDrawAttr eattr = { 0 };
                                int vidx = v_origindex[v];
@@ -4769,7 +4781,6 @@ void DRW_mesh_batch_cache_create_requested(
                DRW_vbo_request(cache->batch.edit_edges, &cache->edit.loop_data);
        }
        if (DRW_batch_requested(cache->batch.edit_lnor, GPU_PRIM_POINTS)) {
-               /* TODO use a range of loops line, before drawing the loose edges. */
                DRW_ibo_request(cache->batch.edit_lnor, &cache->ibo.edit_loops_lines);
                DRW_vbo_request(cache->batch.edit_lnor, &cache->edit.loop_pos_nor);
                DRW_vbo_request(cache->batch.edit_lnor, &cache->edit.loop_lnor);