Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHoward Trickey <howard.trickey@gmail.com>2020-11-28 22:27:10 +0300
committerHoward Trickey <howard.trickey@gmail.com>2020-11-28 22:27:10 +0300
commit458d8a423a2fde63e367c605ad069cc76d34ea2c (patch)
treeb27660e9f5b57cf5a1f66a1e032cc2545f5f92d6 /source/blender/blenlib/intern
parent1169507308b47a882568ecd3bf80daeb05a64f18 (diff)
Speed up finding patch components in new boolean.
By checking if a cell has already been processed in the finding patch component code, an enormous speedup happens. This only will be noticeable if there are lots of patches, and some cells with a large number of patches.
Diffstat (limited to 'source/blender/blenlib/intern')
-rw-r--r--source/blender/blenlib/intern/mesh_boolean.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/mesh_boolean.cc b/source/blender/blenlib/intern/mesh_boolean.cc
index f1510355160..2db939cd628 100644
--- a/source/blender/blenlib/intern/mesh_boolean.cc
+++ b/source/blender/blenlib/intern/mesh_boolean.cc
@@ -1242,6 +1242,7 @@ static Vector<Vector<int>> find_patch_components(const CellsInfo &cinfo, Patches
return Vector<Vector<int>>();
}
int current_component = 0;
+ Array<bool> cell_processed(cinfo.tot_cell(), false);
Stack<int> stack; /* Patch indices to visit. */
Vector<Vector<int>> ans;
for (int pstart : pinfo.index_range()) {
@@ -1258,6 +1259,10 @@ static Vector<Vector<int>> find_patch_components(const CellsInfo &cinfo, Patches
Patch &patch = pinfo.patch(p);
BLI_assert(patch.component == current_component);
for (int c : {patch.cell_above, patch.cell_below}) {
+ if (cell_processed[c]) {
+ continue;
+ }
+ cell_processed[c] = true;
for (int pn : cinfo.cell(c).patches()) {
Patch &patch_neighbor = pinfo.patch(pn);
if (patch_neighbor.component == NO_INDEX) {