diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-08-17 00:13:02 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-08-17 00:13:02 +0300 |
commit | 4b6c482d69cd35b9527dfe0d0ad7c73dfa8fb1ff (patch) | |
tree | 669057ab2a9b21501a603aea8e5a8a1c98eec862 /source/blender/editors/space_view3d | |
parent | 7c96f613e4d05f67f5cd9bf0cec29ca7ce51a3e4 (diff) |
DwM: use batch select for vertex paint mode
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 5698b2fe08a..ce206e9de0c 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -9371,7 +9371,7 @@ void draw_object_select( /* ***************** BACKBUF SEL (BBS) ********* */ - +#ifdef USE_MESH_DM_SELECT static void bbs_obmode_mesh_verts__mapFunc(void *userData, int index, const float co[3], const float UNUSED(no_f[3]), const short UNUSED(no_s[3])) { @@ -9412,6 +9412,15 @@ static void bbs_obmode_mesh_verts(Object *ob, DerivedMesh *dm, int offset) immUnbindProgram(); } +#else +static void bbs_obmode_mesh_verts(Object *ob, DerivedMesh *UNUSED(dm), int offset) +{ + Mesh *me = ob->data; + Gwn_Batch *batch = DRW_mesh_batch_cache_get_verts_with_select_id(me, offset); + GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_FLAT_COLOR_U32); + GWN_batch_draw(batch); +} +#endif #ifdef USE_MESH_DM_SELECT static void bbs_mesh_verts__mapFunc(void *userData, int index, const float co[3], @@ -9659,6 +9668,7 @@ static DMDrawOption bbs_mesh_solid_hide__setDrawOpts(void *userData, int index) } } +#ifdef USE_MESH_DM_SELECT /* must have called GPU_framebuffer_index_set beforehand */ static DMDrawOption bbs_mesh_solid_hide2__setDrawOpts(void *userData, int index) { @@ -9691,6 +9701,31 @@ static void bbs_mesh_solid_verts(const EvaluationContext *eval_ctx, Scene *scene bm_vertoffs = me->totvert + 1; dm->release(dm); } +#else +static void bbs_mesh_solid_verts(const EvaluationContext *UNUSED(eval_ctx), Scene *UNUSED(scene), Object *ob) +{ + Mesh *me = ob->data; + + /* Only draw faces to mask out verts, we don't want their selection ID's. */ + const int G_f_orig = G.f; + G.f &= ~G_BACKBUFSEL; + + { + int selcol; + Gwn_Batch *batch; + GPU_select_index_get(0, &selcol); + batch = DRW_mesh_batch_cache_get_triangles_with_select_mask(me, true); + GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_UNIFORM_COLOR_U32); + GWN_batch_uniform_1i(batch, "color", selcol); + GWN_batch_draw(batch); + } + + G.f |= (G_f_orig & G_BACKBUFSEL); + + bbs_obmode_mesh_verts(ob, NULL, 1); + bm_vertoffs = me->totvert + 1; +} +#endif static void bbs_mesh_solid_faces(Scene *scene, Object *ob) { |