forked from bartvdbraak/blender
DwM: use batch select for vertex paint mode
This commit is contained in:
parent
7c96f613e4
commit
4b6c482d69
@ -2202,8 +2202,13 @@ static Gwn_VertBuf *mesh_batch_cache_get_verts_visible(
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* not yet done! */
|
||||
BLI_assert(0);
|
||||
for (int i = 0; i < vbo_len_capacity; i++) {
|
||||
const MVert *mv = &rdata->mvert[i];
|
||||
if (!(mv->flag & ME_HIDE)) {
|
||||
GWN_vertbuf_attr_set(vbo, attr_id.pos, vidx, mv->co);
|
||||
vidx += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
const uint vbo_len_used = vidx;
|
||||
if (vbo_len_used != vbo_len_capacity) {
|
||||
@ -2350,8 +2355,16 @@ static Gwn_VertBuf *mesh_create_verts_select_id(
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* not yet done! */
|
||||
BLI_assert(0);
|
||||
for (int i = 0; i < vbo_len_capacity; i++) {
|
||||
const MVert *mv = &rdata->mvert[i];
|
||||
if (!(mv->flag & ME_HIDE)) {
|
||||
int select_id;
|
||||
GPU_select_index_get(select_index, &select_id);
|
||||
GWN_vertbuf_attr_set(vbo, attr_id.col, vidx, &select_id);
|
||||
vidx += 1;
|
||||
}
|
||||
select_index += 1;
|
||||
}
|
||||
}
|
||||
const int vbo_len_used = vidx;
|
||||
if (vbo_len_used != vbo_len_capacity) {
|
||||
|
@ -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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user