Differential D16893 Diff 59975 source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_edituv.cc
Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_edituv.cc
| Show First 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| static void extract_edituv_lines_iter_poly_mesh(const MeshRenderData *mr, | static void extract_edituv_lines_iter_poly_mesh(const MeshRenderData *mr, | ||||
| const MPoly *mp, | const MPoly *mp, | ||||
| const int mp_index, | const int mp_index, | ||||
| void *_data) | void *_data) | ||||
| { | { | ||||
| MeshExtract_EditUvElem_Data *data = static_cast<MeshExtract_EditUvElem_Data *>(_data); | MeshExtract_EditUvElem_Data *data = static_cast<MeshExtract_EditUvElem_Data *>(_data); | ||||
| const MLoop *mloop = mr->mloop; | |||||
| const int ml_index_end = mp->loopstart + mp->totloop; | const int ml_index_end = mp->loopstart + mp->totloop; | ||||
| bool mp_hidden, mp_select; | bool mp_hidden, mp_select; | ||||
| if (mr->bm) { | if (mr->bm) { | ||||
| const BMFace *efa = bm_original_face_get(mr, mp_index); | const BMFace *efa = bm_original_face_get(mr, mp_index); | ||||
| mp_hidden = (efa) ? BM_elem_flag_test_bool(efa, BM_ELEM_HIDDEN) : true; | mp_hidden = (efa) ? BM_elem_flag_test_bool(efa, BM_ELEM_HIDDEN) : true; | ||||
| mp_select = (efa) ? BM_elem_flag_test_bool(efa, BM_ELEM_SELECT) : false; | mp_select = (efa) ? BM_elem_flag_test_bool(efa, BM_ELEM_SELECT) : false; | ||||
| } | } | ||||
| else { | else { | ||||
| mp_hidden = (mr->hide_poly) ? mr->hide_poly[mp_index] : false; | mp_hidden = (mr->hide_poly) ? mr->hide_poly[mp_index] : false; | ||||
| mp_select = mr->select_poly && mr->select_poly[mp_index]; | mp_select = mr->select_poly && mr->select_poly[mp_index]; | ||||
| } | } | ||||
| for (int ml_index = mp->loopstart; ml_index < ml_index_end; ml_index += 1) { | for (int ml_index = mp->loopstart; ml_index < ml_index_end; ml_index += 1) { | ||||
| const MLoop *ml = &mloop[ml_index]; | const int edge_i = mr->corner_edges[ml_index]; | ||||
| const int ml_index_last = mp->totloop + mp->loopstart - 1; | const int ml_index_last = mp->totloop + mp->loopstart - 1; | ||||
| const int ml_index_next = (ml_index == ml_index_last) ? mp->loopstart : (ml_index + 1); | const int ml_index_next = (ml_index == ml_index_last) ? mp->loopstart : (ml_index + 1); | ||||
| const bool real_edge = (mr->e_origindex == nullptr || | const bool real_edge = (mr->e_origindex == nullptr || | ||||
| mr->e_origindex[ml->e] != ORIGINDEX_NONE); | mr->e_origindex[edge_i] != ORIGINDEX_NONE); | ||||
| edituv_edge_add(data, mp_hidden || !real_edge, mp_select, ml_index, ml_index_next); | edituv_edge_add(data, mp_hidden || !real_edge, mp_select, ml_index, ml_index_next); | ||||
| } | } | ||||
| } | } | ||||
| static void extract_edituv_lines_finish(const MeshRenderData * /*mr*/, | static void extract_edituv_lines_finish(const MeshRenderData * /*mr*/, | ||||
| MeshBatchCache * /*cache*/, | MeshBatchCache * /*cache*/, | ||||
| void *buf, | void *buf, | ||||
| void *_data) | void *_data) | ||||
| ▲ Show 20 Lines • Show All 154 Lines • ▼ Show 20 Lines | |||||
| void *_data) | void *_data) | ||||
| { | { | ||||
| MeshExtract_EditUvElem_Data *data = static_cast<MeshExtract_EditUvElem_Data *>(_data); | MeshExtract_EditUvElem_Data *data = static_cast<MeshExtract_EditUvElem_Data *>(_data); | ||||
| const BMFace *efa = bm_original_face_get(mr, mp_index); | const BMFace *efa = bm_original_face_get(mr, mp_index); | ||||
| const bool mp_hidden = (efa) ? BM_elem_flag_test_bool(efa, BM_ELEM_HIDDEN) : true; | const bool mp_hidden = (efa) ? BM_elem_flag_test_bool(efa, BM_ELEM_HIDDEN) : true; | ||||
| const bool mp_select = (efa) ? BM_elem_flag_test_bool(efa, BM_ELEM_SELECT) : false; | const bool mp_select = (efa) ? BM_elem_flag_test_bool(efa, BM_ELEM_SELECT) : false; | ||||
| const MLoop *mloop = mr->mloop; | |||||
| const int ml_index_end = mp->loopstart + mp->totloop; | const int ml_index_end = mp->loopstart + mp->totloop; | ||||
| for (int ml_index = mp->loopstart; ml_index < ml_index_end; ml_index += 1) { | for (int ml_index = mp->loopstart; ml_index < ml_index_end; ml_index += 1) { | ||||
| const MLoop *ml = &mloop[ml_index]; | const int vert_i = mr->corner_verts[ml_index]; | ||||
| const bool real_vert = !mr->v_origindex || mr->v_origindex[ml->v] != ORIGINDEX_NONE; | const bool real_vert = !mr->v_origindex || mr->v_origindex[vert_i] != ORIGINDEX_NONE; | ||||
| edituv_point_add(data, mp_hidden || !real_vert, mp_select, ml_index); | edituv_point_add(data, mp_hidden || !real_vert, mp_select, ml_index); | ||||
| } | } | ||||
| } | } | ||||
| static void extract_edituv_points_finish(const MeshRenderData * /*mr*/, | static void extract_edituv_points_finish(const MeshRenderData * /*mr*/, | ||||
| MeshBatchCache * /*cache*/, | MeshBatchCache * /*cache*/, | ||||
| void *buf, | void *buf, | ||||
| void *_data) | void *_data) | ||||
| ▲ Show 20 Lines • Show All 137 Lines • ▼ Show 20 Lines | |||||
| const BMFace *efa = bm_original_face_get(mr, mp_index); | const BMFace *efa = bm_original_face_get(mr, mp_index); | ||||
| const bool mp_hidden = (efa) ? BM_elem_flag_test_bool(efa, BM_ELEM_HIDDEN) : true; | const bool mp_hidden = (efa) ? BM_elem_flag_test_bool(efa, BM_ELEM_HIDDEN) : true; | ||||
| const bool mp_select = (efa) ? BM_elem_flag_test_bool(efa, BM_ELEM_SELECT) : false; | const bool mp_select = (efa) ? BM_elem_flag_test_bool(efa, BM_ELEM_SELECT) : false; | ||||
| if (mr->use_subsurf_fdots) { | if (mr->use_subsurf_fdots) { | ||||
| const BLI_bitmap *facedot_tags = mr->me->runtime->subsurf_face_dot_tags; | const BLI_bitmap *facedot_tags = mr->me->runtime->subsurf_face_dot_tags; | ||||
| const MLoop *mloop = mr->mloop; | |||||
| const int ml_index_end = mp->loopstart + mp->totloop; | const int ml_index_end = mp->loopstart + mp->totloop; | ||||
| for (int ml_index = mp->loopstart; ml_index < ml_index_end; ml_index += 1) { | for (int ml_index = mp->loopstart; ml_index < ml_index_end; ml_index += 1) { | ||||
| const MLoop *ml = &mloop[ml_index]; | const int vert_i = mr->corner_verts[ml_index]; | ||||
| const bool real_fdot = !mr->p_origindex || (mr->p_origindex[mp_index] != ORIGINDEX_NONE); | const bool real_fdot = !mr->p_origindex || (mr->p_origindex[mp_index] != ORIGINDEX_NONE); | ||||
| const bool subd_fdot = BLI_BITMAP_TEST(facedot_tags, ml->v); | const bool subd_fdot = BLI_BITMAP_TEST(facedot_tags, vert_i); | ||||
| edituv_facedot_add(data, mp_hidden || !real_fdot || !subd_fdot, mp_select, mp_index); | edituv_facedot_add(data, mp_hidden || !real_fdot || !subd_fdot, mp_select, mp_index); | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| const bool real_fdot = !mr->p_origindex || (mr->p_origindex[mp_index] != ORIGINDEX_NONE); | const bool real_fdot = !mr->p_origindex || (mr->p_origindex[mp_index] != ORIGINDEX_NONE); | ||||
| edituv_facedot_add(data, mp_hidden || !real_fdot, mp_select, mp_index); | edituv_facedot_add(data, mp_hidden || !real_fdot, mp_select, mp_index); | ||||
| } | } | ||||
| } | } | ||||
| Show All 33 Lines | |||||