[Bf-blender-cvs] [b60f3fe6ada] master: Cleanup: Remove disabled optimization code

Hans Goudey noreply at git.blender.org
Wed Apr 27 23:40:39 CEST 2022


Commit: b60f3fe6ada2904c93383d8f5160b750423725ea
Author: Hans Goudey
Date:   Wed Apr 27 16:40:30 2022 -0500
Branches: master
https://developer.blender.org/rBb60f3fe6ada2904c93383d8f5160b750423725ea

Cleanup: Remove disabled optimization code

Addressing the TODO from the comment isn't a priority at the moment,
and should be solved a bit more generally anyway.

===================================================================

M	source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc

===================================================================

diff --git a/source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc b/source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc
index 877dc05211d..09d0f13c50d 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc
@@ -209,69 +209,6 @@ static Mesh *compute_hull(const GeometrySet &geometry_set)
   return hull_from_bullet(geometry_set.get_mesh_for_read(), positions);
 }
 
-/* Since only positions are read from the instances, this can be used as an internal optimization
- * to avoid the cost of realizing instances before the node. But disable this for now, since
- * re-enabling that optimization will be a separate step. */
-#  if 0
-static void read_positions(const GeometryComponent &component,
-                                           Span<float4x4> transforms,
-                                           Vector<float3> *r_coords)
-{
-  VArray<float3> positions = component.attribute_get_for_read<float3>(
-      "position", ATTR_DOMAIN_POINT, {0, 0, 0});
-
-  /* NOTE: could use convex hull operation here to
-   * cut out some vertices, before accumulating,
-   * but can also be done by the user beforehand. */
-
-  r_coords->reserve(r_coords->size() + positions->size() * transforms.size());
-  for (const float4x4 &transform : transforms) {
-    for (const int i : positions->index_range()) {
-      const float3 position = positions[i];
-      const float3 transformed_position = transform * position;
-      r_coords->append(transformed_position);
-    }
-  }
-}
-
-static void read_curve_positions(const Curves &curves_id,
-                                 Span<float4x4> transforms,
-                                 Vector<float3> *r_coords)
-{
-  const bke::CurvesGeometry &curves = bke::CurvesGeometry::wrap(curves_id.geometry);
-  const int total_size = curves.evaluated_points_num();
-  r_coords->reserve(r_coords->size() + total_size * transforms.size());
-  r_coords->as_mutable_span().take_back(total_size).copy_from(curves.evaluated_positions());
-  for (const float3 &position : curves.evaluated_positions()) {
-    r_coords->append(transform * position);
-  }
-}
-
-static Mesh *convex_hull_from_instances(const GeometrySet &geometry_set)
-{
-  Vector<GeometryInstanceGroup> set_groups;
-  bke::geometry_set_gather_instances(geometry_set, set_groups);
-
-  Vector<float3> coords;
-
-  for (const GeometryInstanceGroup &set_group : set_groups) {
-    const GeometrySet &set = set_group.geometry_set;
-    Span<float4x4> transforms = set_group.transforms;
-
-    if (set.has_pointcloud()) {
-      read_positions(*set.get_component_for_read<PointCloudComponent>(), transforms, &coords);
-    }
-    if (set.has_mesh()) {
-      read_positions(*set.get_component_for_read<MeshComponent>(), transforms, &coords);
-    }
-    if (set.has_curves()) {
-      read_curve_positions(*set.get_curves_for_read(), transforms, &coords);
-    }
-  }
-  return hull_from_bullet(nullptr, coords);
-}
-#  endif
-
 #endif /* WITH_BULLET */
 
 static void node_geo_exec(GeoNodeExecParams params)



More information about the Bf-blender-cvs mailing list