diff options
Diffstat (limited to 'source/blender/draw/intern/draw_cache_extract_mesh_extractors.c')
-rw-r--r-- | source/blender/draw/intern/draw_cache_extract_mesh_extractors.c | 83 |
1 files changed, 0 insertions, 83 deletions
diff --git a/source/blender/draw/intern/draw_cache_extract_mesh_extractors.c b/source/blender/draw/intern/draw_cache_extract_mesh_extractors.c index 0b46d0b6c7d..3ce2ed0fe2c 100644 --- a/source/blender/draw/intern/draw_cache_extract_mesh_extractors.c +++ b/source/blender/draw/intern/draw_cache_extract_mesh_extractors.c @@ -106,89 +106,6 @@ const MeshExtract *mesh_extract_override_get(const MeshExtract *extractor, /** \} */ /* ---------------------------------------------------------------------- */ -/** \name Extract Paint Mask Line Indices - * \{ */ - -typedef struct MeshExtract_LinePaintMask_Data { - GPUIndexBufBuilder elb; - /** One bit per edge set if face is selected. */ - BLI_bitmap select_map[0]; -} MeshExtract_LinePaintMask_Data; - -static void *extract_lines_paint_mask_init(const MeshRenderData *mr, - struct MeshBatchCache *UNUSED(cache), - void *UNUSED(ibo)) -{ - size_t bitmap_size = BLI_BITMAP_SIZE(mr->edge_len); - MeshExtract_LinePaintMask_Data *data = MEM_callocN(sizeof(*data) + bitmap_size, __func__); - GPU_indexbuf_init(&data->elb, GPU_PRIM_LINES, mr->edge_len, mr->loop_len); - return data; -} - -static void extract_lines_paint_mask_iter_poly_mesh(const MeshRenderData *mr, - const MPoly *mp, - const int UNUSED(mp_index), - void *_data) -{ - MeshExtract_LinePaintMask_Data *data = _data; - const MLoop *mloop = mr->mloop; - const int ml_index_end = mp->loopstart + mp->totloop; - for (int ml_index = mp->loopstart; ml_index < ml_index_end; ml_index += 1) { - const MLoop *ml = &mloop[ml_index]; - - const int e_index = ml->e; - const MEdge *me = &mr->medge[e_index]; - if (!((mr->use_hide && (me->flag & ME_HIDE)) || - ((mr->extract_type == MR_EXTRACT_MAPPED) && (mr->e_origindex) && - (mr->e_origindex[e_index] == ORIGINDEX_NONE)))) { - - const int ml_index_last = mp->totloop + mp->loopstart - 1; - const int ml_index_other = (ml_index == ml_index_last) ? mp->loopstart : (ml_index + 1); - if (mp->flag & ME_FACE_SEL) { - if (BLI_BITMAP_TEST_AND_SET_ATOMIC(data->select_map, e_index)) { - /* Hide edge as it has more than 2 selected loop. */ - GPU_indexbuf_set_line_restart(&data->elb, e_index); - } - else { - /* First selected loop. Set edge visible, overwriting any unselected loop. */ - GPU_indexbuf_set_line_verts(&data->elb, e_index, ml_index, ml_index_other); - } - } - else { - /* Set these unselected loop only if this edge has no other selected loop. */ - if (!BLI_BITMAP_TEST(data->select_map, e_index)) { - GPU_indexbuf_set_line_verts(&data->elb, e_index, ml_index, ml_index_other); - } - } - } - else { - GPU_indexbuf_set_line_restart(&data->elb, e_index); - } - } -} - -static void extract_lines_paint_mask_finish(const MeshRenderData *UNUSED(mr), - struct MeshBatchCache *UNUSED(cache), - void *buf, - void *_data) -{ - GPUIndexBuf *ibo = buf; - MeshExtract_LinePaintMask_Data *data = _data; - GPU_indexbuf_build_in_place(&data->elb, ibo); - MEM_freeN(data); -} - -const MeshExtract extract_lines_paint_mask = { - .init = extract_lines_paint_mask_init, - .iter_poly_mesh = extract_lines_paint_mask_iter_poly_mesh, - .finish = extract_lines_paint_mask_finish, - .data_type = 0, - .use_threading = false, - .mesh_buffer_offset = offsetof(MeshBufferCache, ibo.lines_paint_mask)}; - -/** \} */ - -/* ---------------------------------------------------------------------- */ /** \name Extract Line Adjacency Indices * \{ */ |