[Bf-blender-cvs] [772696a1a58] master: Geometry Nodes: Parallelize bounds compuation in points to volume
Hans Goudey
noreply at git.blender.org
Tue Nov 22 19:41:24 CET 2022
Commit: 772696a1a589a6d41eef8b084278e1b886283742
Author: Hans Goudey
Date: Tue Nov 22 12:13:52 2022 -0600
Branches: master
https://developer.blender.org/rB772696a1a589a6d41eef8b084278e1b886283742
Geometry Nodes: Parallelize bounds compuation in points to volume
On my computer this saves a few milliseconds when there are
over 1 million points.
===================================================================
M source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc
===================================================================
diff --git a/source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc b/source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc
index d0b7f6a455f..c6801cf15aa 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc
@@ -6,6 +6,8 @@
# include <openvdb/tools/ParticlesToLevelSet.h>
#endif
+#include "BLI_bounds.hh"
+
#include "node_geometry_util.hh"
#include "BKE_lib_id.h"
@@ -142,9 +144,7 @@ static float compute_voxel_size(const GeoNodeExecParams ¶ms,
return 0.0f;
}
- float3 min, max;
- INIT_MINMAX(min, max);
- minmax_v3v3_v3_array(min, max, (float(*)[3])positions.data(), positions.size());
+ const Bounds<float3> bounds = *bounds::min_max(positions);
const float voxel_amount = params.get_input<float>("Voxel Amount");
if (voxel_amount <= 1) {
@@ -152,7 +152,7 @@ static float compute_voxel_size(const GeoNodeExecParams ¶ms,
}
/* The voxel size adapts to the final size of the volume. */
- const float diagonal = math::distance(min, max);
+ const float diagonal = math::distance(bounds.min, bounds.max);
const float extended_diagonal = diagonal + 2.0f * radius;
const float voxel_size = extended_diagonal / voxel_amount;
return voxel_size;
More information about the Bf-blender-cvs
mailing list