Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines.cc
| Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | |||||
| static void extract_lines_iter_poly_mesh(const MeshRenderData *mr, | static void extract_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) | ||||
| { | { | ||||
| GPUIndexBufBuilder *elb = static_cast<GPUIndexBufBuilder *>(data); | GPUIndexBufBuilder *elb = static_cast<GPUIndexBufBuilder *>(data); | ||||
| /* Using poly & loop iterator would complicate accessing the adjacent loop. */ | /* Using poly & loop iterator would complicate accessing the adjacent loop. */ | ||||
| const MLoop *mloop = mr->mloop; | |||||
| const int *e_origindex = (mr->edit_bmesh) ? mr->e_origindex : nullptr; | const int *e_origindex = (mr->edit_bmesh) ? mr->e_origindex : nullptr; | ||||
| if (mr->use_hide || (e_origindex != nullptr)) { | if (mr->use_hide || (e_origindex != nullptr)) { | ||||
| const int ml_index_last = mp->loopstart + (mp->totloop - 1); | const int ml_index_last = mp->loopstart + (mp->totloop - 1); | ||||
| int ml_index = ml_index_last, ml_index_next = mp->loopstart; | int ml_index = ml_index_last, ml_index_next = mp->loopstart; | ||||
| do { | do { | ||||
| const MLoop *ml = &mloop[ml_index]; | const int edge_i = mr->corner_edges[ml_index]; | ||||
| if (!((mr->use_hide && mr->hide_edge && mr->hide_edge[ml->e]) || | if (!((mr->use_hide && mr->hide_edge && mr->hide_edge[edge_i]) || | ||||
| ((e_origindex) && (e_origindex[ml->e] == ORIGINDEX_NONE)))) { | ((e_origindex) && (e_origindex[edge_i] == ORIGINDEX_NONE)))) { | ||||
| GPU_indexbuf_set_line_verts(elb, ml->e, ml_index, ml_index_next); | GPU_indexbuf_set_line_verts(elb, edge_i, ml_index, ml_index_next); | ||||
| } | } | ||||
| else { | else { | ||||
| GPU_indexbuf_set_line_restart(elb, ml->e); | GPU_indexbuf_set_line_restart(elb, edge_i); | ||||
| } | } | ||||
| } while ((ml_index = ml_index_next++) != ml_index_last); | } while ((ml_index = ml_index_next++) != ml_index_last); | ||||
| } | } | ||||
| else { | else { | ||||
| const int ml_index_last = mp->loopstart + (mp->totloop - 1); | const int ml_index_last = mp->loopstart + (mp->totloop - 1); | ||||
| int ml_index = ml_index_last, ml_index_next = mp->loopstart; | int ml_index = ml_index_last, ml_index_next = mp->loopstart; | ||||
| do { | do { | ||||
| const MLoop *ml = &mloop[ml_index]; | const int edge_i = mr->corner_edges[ml_index]; | ||||
| GPU_indexbuf_set_line_verts(elb, ml->e, ml_index, ml_index_next); | GPU_indexbuf_set_line_verts(elb, edge_i, ml_index, ml_index_next); | ||||
| } while ((ml_index = ml_index_next++) != ml_index_last); | } while ((ml_index = ml_index_next++) != ml_index_last); | ||||
| } | } | ||||
| } | } | ||||
| static void extract_lines_iter_ledge_bm(const MeshRenderData *mr, | static void extract_lines_iter_ledge_bm(const MeshRenderData *mr, | ||||
| const BMEdge *eed, | const BMEdge *eed, | ||||
| const int ledge_index, | const int ledge_index, | ||||
| void *data) | void *data) | ||||
| ▲ Show 20 Lines • Show All 92 Lines • Show Last 20 Lines | |||||