diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-10-12 08:25:16 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-10-12 08:25:16 +0300 |
commit | 33e2cf2aab35d65009b21f197aa2d1e2c81b0c6f (patch) | |
tree | 25f02c24a61853dd4c99a5668ed7efe15c9a6e24 /source/blender/draw/intern/draw_cache_impl_mesh.c | |
parent | 8ef8b64fc6135f6a32343999d1d6d5090bc0f1c4 (diff) |
Cleanup: fill vertex buffer in order
Diffstat (limited to 'source/blender/draw/intern/draw_cache_impl_mesh.c')
-rw-r--r-- | source/blender/draw/intern/draw_cache_impl_mesh.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c index 2672e23bb7f..755d9e3bef1 100644 --- a/source/blender/draw/intern/draw_cache_impl_mesh.c +++ b/source/blender/draw/intern/draw_cache_impl_mesh.c @@ -1647,8 +1647,9 @@ static void add_overlay_tri( if (vbo_data) { fflag = mesh_render_data_looptri_flag(rdata, bm_looptri[0]->f); - uint i_prev = 1, i = 2; - for (uint i_next = 0; i_next < 3; i_next++) { + for (uint i = 0; i < 3; i++) { + const int i_next = (i + 1) % 3; + const int i_prev = (i + 2) % 3; vflag = mesh_render_data_vertex_flag(rdata, bm_looptri[i]->v); /* Opposite edge to the vertex at 'i'. */ EdgeDrawAttr eattr = {0}; @@ -1658,9 +1659,6 @@ static void add_overlay_tri( } eattr.v_flag = fflag | vflag; GPU_vertbuf_attr_set(vbo_data, data_id, base_vert_idx + i, &eattr); - - i_prev = i; - i = i_next; } } } @@ -1709,8 +1707,9 @@ static void add_overlay_tri_mapped( if (vbo_data) { fflag = mesh_render_data_looptri_flag(rdata, efa); - uint i_prev = 1, i = 2; - for (uint i_next = 0; i_next < 3; i_next++) { + for (uint i = 0; i < 3; i++) { + const int i_next = (i + 1) % 3; + const int i_prev = (i + 2) % 3; const int v_orig = v_origindex[mloop[mlt->tri[i]].v]; if (v_orig != ORIGINDEX_NONE) { BMVert *v = BM_vert_at_index(bm, v_orig); @@ -1737,9 +1736,6 @@ static void add_overlay_tri_mapped( } eattr.v_flag = fflag | vflag; GPU_vertbuf_attr_set(vbo_data, data_id, base_vert_idx + i, &eattr); - - i_prev = i; - i = i_next; } } } |