diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-07-15 15:18:30 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-07-15 15:23:35 +0300 |
commit | e8f8c13d4b76ba587ef7cf33370b286d4fbd36bc (patch) | |
tree | 371472ae220ad8740b310aaa8f4c5746448302c5 /source/blender/bmesh/tools/bmesh_intersect_edges.c | |
parent | 0c062a9e082130212447c2b67e8e16b8a2e622d1 (diff) | |
parent | 44bb73e765a6f79bc14a46449368f83e572d8bad (diff) |
PointCloud: Initial rendering support for Workbenchtmp-pointcloud-render
Also includes outline overlays. Removes the temp overlay drawing
We make the geometry follow camera like billboards this uses less
geometry. Currently we use half octahedron for now. Goal would be
to use icospheres.
This patch also optimize the case when pointcloud has uniform radius.
However we should premultiply the radius prop by the default radius
beforehand to avoid a multiplication on CPU.
Differential Revision: https://developer.blender.org/D8301
Diffstat (limited to 'source/blender/bmesh/tools/bmesh_intersect_edges.c')
-rw-r--r-- | source/blender/bmesh/tools/bmesh_intersect_edges.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/source/blender/bmesh/tools/bmesh_intersect_edges.c b/source/blender/bmesh/tools/bmesh_intersect_edges.c index 99a5a9edb57..52231033fd3 100644 --- a/source/blender/bmesh/tools/bmesh_intersect_edges.c +++ b/source/blender/bmesh/tools/bmesh_intersect_edges.c @@ -833,15 +833,37 @@ bool BM_mesh_intersect_edges( } if (pair_array) { + BMVert *v_key, *v_val; pair_iter = &pair_array[0]; for (i = 0; i < pair_len; i++, pair_iter++) { BLI_assert((*pair_iter)[0].elem->head.htype == BM_VERT); BLI_assert((*pair_iter)[1].elem->head.htype == BM_VERT); BLI_assert((*pair_iter)[0].elem != (*pair_iter)[1].elem); - BMVert *v_key, *v_val; v_key = (*pair_iter)[0].vert; v_val = (*pair_iter)[1].vert; BLI_ghash_insert(r_targetmap, v_key, v_val); + } + + /** + * The weld_verts operator works best when all keys in the same group of + * collapsed vertices point to the same vertex. + * That is, if the pairs of vertices are: + * [1, 2], [2, 3] and [3, 4], + * They are better adjusted to: + * [1, 4], [2, 4] and [3, 4]. + */ + pair_iter = &pair_array[0]; + for (i = 0; i < pair_len; i++, pair_iter++) { + v_key = (*pair_iter)[0].vert; + v_val = (*pair_iter)[1].vert; + BMVert *v_target; + while ((v_target = BLI_ghash_lookup(r_targetmap, v_val))) { + v_val = v_target; + } + if (v_val != (*pair_iter)[1].vert) { + BMVert **v_val_p = (BMVert **)BLI_ghash_lookup_p(r_targetmap, v_key); + *v_val_p = (*pair_iter)[1].vert = v_val; + } if (split_faces) { /* The vertex index indicates its position in the pair_array flat. */ BM_elem_index_set(v_key, i * 2); |